Wednesday, January 13, 2010

Use Gmail smtp for send email in Magento

I building website using Magento, so many time I need to test email sending but I got some problem because my environment is Windows.
Windows not false just not good ebough for this point.

So I need to modified Magento core file to use Gmail smtp for sending email.

Just follow this instruction.

Open and modified /app/code/core/Mage/Core/Model/Email/Template.php

in function function send($email, $name=null, array $variables = array())

replace


try {
$mail->send(); // Zend_Mail warning..
$this->_mail = null;
}


with


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

$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
try {
$mail->send($transport);
}


Have a nice day.

No comments: