Posted on

SMTP Pro with Magento: A sort-of user guide.

This blog post is about the SMTP Pro extension. It is my attempt at full explanations to some very good questions/feedback from Chris Last in his comment on an earlier post. I decided that I should give thorough explanations to the questions and they probably belong in a blog post rather than a reply comment. Hopefully it’ll form a mini user-guide, I’ll try to update it as such over time.

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.

There are too many sections in Config->Advanced->System for me to make complete sense of:

Mail Sending Settings – do these have any effect?
Disable Email Communications No
Host localhost
Port (25) 25
Set Return-Path no

1) The Mail Sending Settings are the built in Magento ones, they don’t work very well for custom SMTP servers and you can safely ignore them. One thing to note though. I do adhere to their disable configuration in my extension. So if you disable all emails using the core config here, all emails do stop even if sending via SMTP Pro.
Continue reading SMTP Pro with Magento: A sort-of user guide.

Posted on

Magento 1.5.0.1 and SMTPPro 1.4.2 Now Working – Free Gmail/SMTP, ahoy!

There have been several reports of my SMTP Pro email extension failing on Magento 1.5. I hadn’t tested or recommended installing it on Magento 1.5 and wasn’t going to for a little while. You could say I’m not really an early adopter when it comes to Magento versions.

However, the ever helpful Rhonda (@rondata) from Magento got in touch with me late last week to report there may have been a packaging problem with my extension that has made it unable to be used on the new Magento Connect. So I thought if I was going to repackage it, I may as well also fix it up for Magento 1.5 – and so here is SMTPPro version 1.4.2.

As always you can download the package manually here (or via Magento Connect) to check it out before you install it manually.

I have tested the extension on Magento 1.4.2 and 1.5.0.1, also tested a Magento Connect install on 1.5.0.1. Everything seems to be in order. The change in 1.5 was a move to array based email addresses and names in the Email_Template class.

I still feel like it’s shoddy OO that I have to override an entire method and duplicate all the logic in it just to swap in my SMTP transport configuration. For those that care, I did try some techniques to avoid it, but the default transport is explicitly set by the core code if a return path is set, which invalidates anything I can do in a subclass – short of temporarily hijacking the return path configuration, which I may resort to doing in the next release.

In the process of testing a Magnto Connect install I did see a very cool feature in the latest Magento, and I may just have missed it in the earlier releases as I seldom use Magento Connect anymore.

Upload a  Package directly

Installing a package directly from within the downloader module will surely make the day of many commercial extension developers – at least until they can sell extensions directly on Magento Connect*.

Anyway, that’s about it – the new version supports 1.5, and can be downloaded/installed on Magento Connect. Go enjoy some free SMTP/Google Apps/Gmail email sending! Please let me know if you have any problems or spot any bugs.

* Speaking of which, I wonder what % Magento will take… Apple set a pretty high benchmark at 30%. Magento doesn’t quite have the same kung-fu grip on distribution though so maybe it’ll be lower.

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

Latest version of SMTP Pro Finally Uploaded to Magento Connect

Geez it’s been a long time coming thanks to Invalid package.xml format errors and duplicate maintainers and goodness-knows-what else. You can finally get the latest version of SMTP Pro – 1.3.4 – even though it’s identical to 1.3. (thank Magento Connect…).

For those who want to install the Magento extension manually (and if you are engineering Magento you probably should) – you can get version 1.3.4 of SMTP Pro here.

If you read my last post on the improvements, you’ll know that it has some great new features for sending, and logging email in Magento using either SMTP or Gmail/Google Apps. So please give it a try and let me know what you think.

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.