Custom email server (transport) with Magento

Custom email server (transport) with Magento

Magento has quite interesting email sending capabilities. However, those are more in terms of email templates then selecting a non-built in email server. Sometimes, your web hosting might have separate mail server and even the simple php send mail does not work. In such cases you are forced to use an external mail server that supports SMTP. Good example of this is a Gmail.

So, how do we “switch” our Magento to use Gmail? Here is a small extension I wrote for my self. Figured why not give it away.

Download Ajzele_MailTransport extension.

And here is a little screenshot that shows the available config options.

As always, use at your own risk 🙂

You made it all the way down here so you must have enjoyed this post! You may also like:

Magento 2 Webhook Notifications Deni Pesic
, | 0

Magento 2 Webhook Notifications

How to programmatically create customers in Magento 2.3.x Deni Pesic
, | 2

How to programmatically create customers in Magento 2.3.x

Reorder input fields on Shipping and Billing step in Magento 2 Mladen Ristic
, | 14

Reorder input fields on Shipping and Billing step in Magento 2


  1. Works for me in an old Magento 1.4.1 shop. BUT there seems to be some rubbish code in the extension app\code\community\Ajzele\Photic is not needed by the extension.

  2. We need to send 65.000 customers mail from magento, this seems not to be possible, bcs magento runs into huge memory amount with collecting all email addresses first.

    Any Idea how this could be solved or is email handling in this or similar extension done different, so that email recipients amount is kind of infinite?


  3. I recomond not using this code. There is no real support behind it. I had to unistall it for my 1.6.1 version and installed jschroders free implantation. That Code dose work and can be found on magento connect. He does a good job of supporting his stuff. Unlike here where my requests went into a black hole 🙁

  4. With which versions of magento it is working ?

    Does this extension uses Google server to send the email or ours ?

  5. Im using it with Magento 1.6.1 with some issues. Emails sent from admin are not being sent, but emails like contact us, or password resets work. Strange??? And thoughts how how to figure out what the problem is?

  6. Unfortunately, I have the very same problem as Jurgen. Magento 1.4.1 just doesn’t seem to notice my settings at all and still sends mails the old way.

  7. Hi,

    I’ve been struggling all day to get order confirmations from Magento. I’ve checked & double checked forums for some answers, but with no success. There seems to be a problem with my smtp settings, but can’t find the problem. Some clients do get a confirmation e-mail, and the contact form is also working.

    So I installed this extension, and it appears in admin, and filled in al details for my Google mail account. I also flushed Magento cache, but it doesn’t seem to use the settings that I entered. Do I have to disable something in Magento also to get this module to work?

    best regards,


  8. Worked seamlessly for me on magento! Just copy all the files to their respective folders, maybe flush the cache, and you’re all set! Thanks a lot!

  9. For Magento version I was getting error that Zend_Validate_Hostname_Com class does not exist when orders were placed and emails were not send neither when orders placed nor when orders invoiced

    I followed a post online where the solutions was to copy/rename Zend_Validate_Hostname_De to Zend_Validate_Hostname_Com. It worked for me and know emails is being sent

    I looked in mangeto version 1.4 and there is class Zend_Validate_Hostname_Com and that’s probably why this plugin worked right the way for magento version 1.4

  10. Dema501 already mentioned the error:
    Undefined class constant ‘XML_PATH_SENDING_SET_RETURN_PATH’

    This comes up because this plugin is developed for 1.4 and breaks for versions below. To fix it just add the following:

     const XML_PATH_SENDING_SET_RETURN_PATH = 'system/smtp/set_return_path';
        const XML_PATH_SENDING_RETURN_PATH_EMAIL = 'system/smtp/return_path_email';

    in class Ajzele_MailTransport_Model_Core_Email_Template after line:

    ' const MODULE_SETTINGS_PATH = 'ajzele_mail_transport';

    I hope it helps

  11. My site it´s still in test, obviously
    I have the same error as Darley Cassimiro.
    When I use the contact form, I get the message: Unable to submit your request. Please, try again later

  12. Hello i get error

    Undefined class constant ‘XML_PATH_SENDING_SET_RETURN_PATH’

    at $setReturnPath = Mage::getStoreConfig(self::XML_PATH_SENDING_SET_RETURN_PATH);

    here should be
    $setReturnPath = Mage::getStoreConfigFlag(Mage_Newsletter_Model_Subscriber::XML_PATH_SENDING_SET_RETURN_PATH);

    But these settings are in fact belong to the newsletter?

    ? ?????????

  13. how do I install this? I transfer all the file under community. But it doesn’t do anything. I did refresh cache as well.



  14. A heads-up, a site I took over which was not developed by me, using a popular Gmail extension, recently, client reported a number of customers couldn’t do the checkout at the last Review step, but a few were able to during the same period. I only got a chance to look into the issue late at night after the site came back to normal, couldn’t find anything except in the report folder, there were some 35 reports related to that Gmail extension, the date and hours match the checkout issue customers ran into.

    I weren’t able to replicate the problem but pretty sure it was caused by Google mail server, it appeared that Google mail server had connection issue during those hours, and Magento was not able to receive a notification; one persistent customer tried to checkout a 3 times and the third went through, somehow his email was not being recorded (how could this ever happened still is a big puzzle to me) which resulted client not able to send a comment to him (client was not aware that missing email was the issue), to add insult to injury, the server had a sql connection issue in the same day – this three issues caused a big panic.

    I am still not sure how could that Google mail server connection issue causing checkout not being able to execute, shouldn’t it be that cilent and customer not able to receive order email only?!

  15. Hello,

    I install and gote this message when use the contact us: Unable to submit your request. Please, try again later

    and the port? that is not supost to have a setup option for you put the port for gmail?

    thank you,


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.