Posted on

Sending Emails by Queue in Magento 1.9.1

My last blog post was over 6 months ago, so I think I’m technically way past due for a new post. In this post I wanted to take a tour through the new functionality in Magento 1.9.1 with regards to sending emails from your store.

The astute among you will have noticed there were some changes to email in Magento 1.9.1 from the Magento 1.9.1 release notes. Two things jump out as requiring further investigation:

  1. “all Magento e-mails (including order confirmation and transactional) are now queued and sent according to your configured cron schedule”
  2. “boasts responsive default email templates so customers can read your order confirmation emails and newsletters on any device”

The first change sounds worrying to me, after years of emails from merchants struggling to get their Magento store to send emails – anything which makes it _harder_ seems like a bad idea to me. However, we’ll look through the changes and see what’s new.

The second change sounds really good – I was tinkering on a responsive email extension myself, so it’s pleasing to see it has already become core functionality. I’ll take a look through the template changes, and how they affect your store in the second part of this blog post series.

Using cron to send Magento Emails

Magento email sending all boils down to the Template class Mage_Core_Model_Email_Template, you can see below the change for queuing has been to introduce a check for an available queue in the template class, and if available to enqueue the message with all of it’s data and return immediately.
Continue reading Sending Emails by Queue in Magento 1.9.1

Posted on

Magento SMTP Pro 2 – Free and Open Source SMTP Configuration

I’m very pleased to announce the release of version 2 of SMTP Pro. It’s been a long time coming, but my most popular extension should once again be your first choice for custom email integrations. Version 2 is a full rewrite that adds support for all of the latest versions of Magento, an improved admin experience, a better self test and modern coding standards. You can find out more and subscribe for updates over on the SMTP Pro product page, magesmtppro.com.

Background

I first released SMTP Pro 5 years ago, when it was purely for connecting to Google Apps accounts to send store email. Since then I have added support for custom SMTP servers, Amazon SES, email logging, self testing and have helped thousands of merchants get their store emails working.

SMTP Pro was my first open source project and has been by far the most successful with over 30,000 downloads and dozens of contributors over the years. With nearly 150 reviews on Magento Connect and an average of 4.4/5 stars, it’s the positive, constructive feedback of the community I really enjoy.

Screen Shot 2014-05-22 at 9.28.07 pm

This update has been long overdue, but I’m very happy to say that SMTP Pro is back, and better than ever.

Where to Download

You can download Magento SMTP Pro from any of these places:

Continue reading Magento SMTP Pro 2 – Free and Open Source SMTP Configuration

Posted on

Using SMTP Pro and Ebizmarts’ MailChimp extension in Magento

This is just a quick blog post that will hopefully help people facing the clash in Magento between my SMTPPro email extension and Ebizmarts’ MailChimp extension.

The clash occurs only in one class Mage_Core_Model_Email_Template which we both override to extend the default Magento email sending capability.

Because it only makes sense to use either SMTPPro or MailChimp as your ESP if you want to use SMTP Pro you can safely disable the MailChimp core class override and then SMTPPro will send the store emails using whichever method you have configured.

Update July 2013: I have since released a premium extension for sending email using Amazon SES called MageSend, if you’re having toruble sending email with Magento, please check it out, it was created to solve many common Magento email issues.

To remove the core override edit code/local/Ebizmarts/Mailchimp/etc/config.xml and remove the following XML:

<core>
    <rewrite>
        <email_template>Ebizmarts_Mailchimp_Model_Email_Template</email_template>
    </rewrite>
</core>

When/Why is this safe to do?

You can do this when you are not using the MailChimp STS capability and want to use SMTPPro to send your emails. If you don’t want to send via SMTPPro, just uninstall it to resolve the conflict.

You can see in the first lines of the override class Ebizmarts_Mailchimp_Model_Email_Template why this is safe:

if(!Mage::helper('mailchimp')->isStsActivated()){
    return parent::send($email, $name, $variables);
}

This means that if you are not using STS, then the whole override is basically a noop.

One caution I have for you though, once you modify an extension, you have to remember to apply the same patch each time you upgrade it, otherwise the clash will creep back in!

Update: I missed some emails notifying me of comments, I missed this fairly important one from Ebizmarts with basically this fix in it… On a related note, if I didn’t reply to your comment for the last few weeks, that’s why.

Posted on

New Version of SMTP Pro now supports Magento 1.4.2 and has fewer bugs

I’ve been neglecting my Magento extensions a bit lately and it somewhat ironically caught up with me yesterday. We’re developing a new store on Magento 1.4.2 and when it came to setting up the Google Apps email I naturally enough installed my own extension (that is why I built it, after all). This post describes the fixes and changes in the latest version of my SMTP Pro Magento email extension.

I found a number of issues with it, one related to the sub-directory install, one related to multi-store and others to do with the Magento version, that needed to be fixed (in a hurry). So to those of you reporting issues over the last month or so, sorry for the delay getting to them. Better late than never eh Fontis.

In addition to testing with Magento 1.4.2 which I can confirm works, here’s what I have fixed/changed:

  • Fixed the self-test when running it from a webstore installed in a subdirectory.
  • Fixed the Cannot set standard header from addHeader() exception. It was caused by an upgrade to Zend in Magento 1.4.2. Reported here.
  • Added German translations which I got from Thomas at NetResearch, Many thanks! (and apologies for taking months to finally roll them out).
  • Added better logging around the ‘not valid for send’ state.
  • Fixed the 404 error you get when running self-test on a store with the ‘use store code in url’ setting turned on. I suspect this may have been causing a few issues.

The SMTP extension is available on Magento Connect or you may prefer to download your Magento connect extensions manually. The release file for SMTP Pro version 1.4.0 is available here if you like to install Magento extensions manually.

Posted on

New SMTP Pro Magento Email extension released

I’ve had a chance to make a couple of improvements to my SMTP Pro email extension for Magento. Both changes are not exactly life altering, one adds extra error detection to the self-test, and the other fixes a header problem with the self-test (reported by Phil). More details follow about the changes, if you want to get the extension, download SMTP Pro on Magento Connect. (Updated: finally on Magento Connect!)

I now send a real live contact form message as part of the testing – and ensure that when the email sends, my extension code is actually being called. I’ve had a lot of people reporting problems with emails not sending lately, only to find it’s because some other extension is interfering with my email sending. This tweak to the self test will help identify those issues.

This is implemented as a static variable on the self test controller, that is set before sending the test email and then altered by the email observer (if it is called as expected):

// Now we test that the actual core overrides are occuring as expected.
// We trigger the password forgot email, as though a user had done so.
 
self::$CONTACTFORM_SENT = false;
$this->_sendTestContactFormEmail();
 
// If everything worked as expected, the observer will have set this value to true.
if (self::$CONTACTFORM_SENT) {
	$msg = $msg . "<br/> Contact Form test email used SMTPPro to send correctly.";
} else {
	$success = false;
	$msg = $msg . "<br/> Contact Form test email did not use SMTPPro to send.";
}

and the code in the observer that alters this variable:

// For the self test, if we're sending the contact form notify the self test class
if($event->getTemplate() == "contacts_email_email_template") {
        include_once "app/code/community/Aschroder/SMTPPro/controllers/IndexController.php";
        Aschroder_SMTPPro_IndexController::$CONTACTFORM_SENT = true;
}

The other change was trivial, adding a ->setFrom() call when sending the test email. Thanks to Phil for pointing that out.

Lastly, Eric requested a useful feature which I will add, but I haven’t had time to put that in to this release, next time!

Let me know any feedback you have on the changes, or if you’re having trouble sending emails in Magento – feedback welcome.