[magento] Use sendgrid email from the Magento

When you set up your own e-commerce website, you will be excited to see your site from online and start asking your own friend to look or test for..

However, your friends will bounce you back that your web site is not functioning properly since they are not getting emails when they setting up the user account.

The issue is your domain name of email might not be categorized as clean email  which your email will be filtered as spam mail.

In that case, you should use the service that comes out from whitelist email provider or domain names.

The good example is sendgrid.com.

The below section is how to setup the sendgrid as your email provider from magento.

 

1. go to the sendgrid.com or other providers and create an account. You have make a note for the user id and password for the later configuration in Magento. Please do not forget to check your email so that you can properly activate your account.

2.  Once your account is activated, go to the magento admin console. then go to the system -> Configuration

3. Then, you can go Advanced navigation from the left side and select the System.

 

4. setup the host name and port as smtp.sendgrid.net and 587 .

5. Then, modify the app/code/core/Mage/Core/Model/Email/Template.php file as below;

 

/**
* Retrieve mail object instance
*
* @return Zend_Mail
*/
public function getMail()
{
/* begin */
$my_smtp_host = Mage::getStoreConfig(‘system/smtp/host’);
$my_smtp_port = Mage::getStoreConfig(‘system/smtp/port’);
$config = array( ‘port’ => $my_smtp_port,

‘auth’ => ‘login’,
‘username’ => ‘sendgriduserid‘,
‘password’ => ‘sendgriduserpassword‘);
$transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config);
Zend_Mail::setDefaultTransport($transport);
/* End */

if (is_null($this->_mail)) {
$this->_mail = new Zend_Mail(‘utf-8’);
}
return $this->_mail;
}

That is it. It will work just fine.

 

** If you have to change the email header image to your site from Magento, go the Design from the navigator.

Then, you can see the section of Transactional Emails from the bottom of page. Then, you can find the new image for your email header.

 

And there is a new issue for me to set up a new magento web site with sendgrid that it is sending new user and email subscriber case. But it was not sending any transactional emails such as order and so on.

The solution is simple as below;

 

app/code/core/Mage/Sales/Model/Order.php

Change
$mailer->setQueue($emailQueue)->send();
to 
$mailer->send();


This is working fine to me. :)
error: Content is protected !!