I setup magento to use a SMTP server account to send emails.

I used the System->Configuration->Advanced->System->Mail Sending Settings and overwrote getMail() from app/code/core/Mage/core/Model/Email/Template.php as described here.

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);
            /* Changes End */
            $this->_mail = new Zend_Mail('utf-8');
        return $this->_mail;  

Now to the question: How do I send the newsletter using second smtp account (same mail server)?

I would like to use 2 accounts at the same time. One for newsletter and one for everything else like support, order, ...

  • Have you thought about just using Mailchimp? You won't have to worry about your server getting blacklisted – brentwpeterson Sep 23 '13 at 18:38

Configure Username + password

As already done in your function above, you could create fields for your System Configuration to enter these details and request them in your function like this:



Use Newsetter, General, etc. data

There is also a function getMail() in Mage_Newsletter_Model_Template. You could adapt this function for sending and using the Newsletter-SMTP data.

E-Mail Account Segmentation

If you need further segmentation of the e-mails sent, my idea is to depend this on the e-mail templates used so that you create an assigment Template > Account.

| improve this answer | |

for those to whom it dosn't work the modification of the :

public function getMail()

You can try modifing the public function send()

adding after:

public function send($email, $name=null, array $variables = array())
        if(!$this->isValidForSend()) {
            return false;

the followinng code with your smtp server configurations

$config = array(
        'ssl' => 'ssl', //optional
        'port' => '25', //or other port
        'auth' => 'login', //auth type
        'username' => 'yourusername',
        'password' => 'password'

$transport = new Zend_Mail_Transport_Smtp('mail.yoursmtpserver.com', $config);

modify the the line:




save and flush cache.

The host and port fields under System-> Email setting must be blank.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.