Set smtp info in magento

First we need to set hostname in admin panel of magento

so go to Admin > Config > System >Main Sending Settings ..

and then enter your host name of smtp in Host field.

Now, setting for coding side…….

Open app/code/core/Mage/Core/Model/Email/Template.php and add the following code in send() method.

$config = array(
‘ssl’ => ‘tls’, //optional
‘port’ => Mage::getStoreConfig(‘system/smtp/port’), //optional – default 25
‘auth’ => ‘login’,
‘username’ => ‘’, // enter your username of smtp
‘password’ => ‘pass’ // enter your password of smtp

$transport = new Zend_Mail_Transport_Smtp(Mage::getStoreConfig(‘system/smtp/host’), $config);
First add above two php statement in top of send() method.

Then we need to find below try and catch block in method.

try {
$this->_mail = null;
catch (Exception $e) {
$this->_mail = null;
return false;

Now we need to replace this line




In short we need to pass transport object as reference of smtp in zend’s send method.

Now we need to check our smtp is set or not at front side.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s