sending emails

If you want to send emails with Magento you need to configure it to use an SMTP server – that is, the outgoing server that takes care of delivering your messages.

Remember anyway that if you set a normal SMTP server on Magento – like the ones associated to Gmail or Hotmail – you could always run into deliverability problems.

And here’s the procedure:

1. Login to Magento and choose System->Configuration->Advanced->System->Mail Sending Settings.

2. Insert your SMTP settings: your SMTP server name.

3. Copy in your local the file app/code/core/Mage/core/Model/Email/Template.php.

4. Enable that module.

5. Open the file Template.php and change the getMail() function this way:

public function getMail()
{
if (is_null($this->_mail)) {
/* changes 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’ => ’email@domain.com’,
‘password’ => ‘yourpassword’                                               );
$transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config);
Zend_Mail::setDefaultTransport($transport);
/* Changes End */
$this->_mail = new Zend_Mail(‘utf-8’);
}
return $this->_mail;
}

That’s it, you can deliver emails with Magento.

Translate »