Monday 9 June 2014

Magento send email using smtp

First we need to Override Magento Core Files Into local

Go to : app > code > core > Mage > Core > Model > Email.php
AND
app > code > core > Mage > Core > Model >Email > Template.php

Copy These files and paste here

Go to : app > code > local > Mage > Core > Model > Email.php
AND
app > code > local > Mage > Core > Model >Email > Template.php


After paste open these files and add following code in "send" function with your credentials:

$config = array('ssl' => 'tls',
'port' => 587,
'auth' => 'login',
'username' => 'username@gmail.com',
'password' => 'password');

$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config); 
and replace: 
$mail->send(); 
with:
$mail->send($transport);
 
After this clear your cache.
Now magento will be able to send emails for you.
Best of luck 

No comments:

Post a Comment