Use custom email server for Magento based ecommerce shops
You will need to change code on the file : app/code/core/Mage/Core/Model/Email/Template.php
Comment out the existing getMail() method.
And replace the method with the following code.
Remember: changing the core Magento code is not the greatest idea as upgrade of Magento will eventually become a big issue at a later time (if you keep doing this).
You can consider this as a quick test if you can make external mail server working with magento. However, ideally you need to take a better approach.
public function getMail()
{
if (is_null($this->_mail)) {
/*Start of added code to specify config*/
$my_smtp_host = Mage::getStoreConfig('system/smtp/host');
$my_smtp_port = Mage::getStoreConfig('system/smtp/port');
$config = array(
'ssl' => 'tls',
'port' => $my_smtp_port,
'auth' => 'login',
'username' => 'account@gmail.com',
'password' => 'secret'
);
$transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config);
Zend_Mail::setDefaultTransport($transport);
/*End of added code to specify config*/
$this->_mail = new Zend_Mail('utf-8');
}
return $this->_mail;
}
https://stackoverflow.com/questions/11558156/magento-how-enable-smtp-server-authentication-and-secure-transport
Sayed Ahmed
647-624-8509, sayedum
Linkedin: https://ca.linkedin.com/in/sayedjustetc
Blog: http://sitestree.com, http://bangla.salearningschool.com
