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

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

Google Apps Email/Gmail Magento Extension v0.5 released

It’s been a while since I have written any updates on my Gmail and Google Apps email extension for Magento. I have just released version 0.5 and thought now would be a good opportunity to write a quick update on the changes and what I have planned for SMTP email support in Magento.

Version 0.5 of Google Apps Email/Gmail Magento Extension

Firstly the changes in the latest release of the Google Apps/Gmail Magento extension. Both have been inspired by user feedback so two ‘thank you’s to follow. Firstly thanks to Blue Acorn for pointing out the lack of multi-store capability on the self test. It’s actually a little clunky getting the store parameters in the admin of Magento, my custom button needed to add the parameter like so:

$buttonBlock = $this->getElement()->getForm()->getParent()->getLayout()->createBlock('adminhtml/widget_button');
 
$params = array(
    'website' => $buttonBlock->getRequest()->getParam('website')
);
 
$url = Mage::helper('adminhtml')->getUrl("googleappsmailtest", $params);

And then the controller needed to actually pick up which Magento store to get the config for:

$websiteModel = Mage::app()->getWebsite($this->getRequest()->getParam('website'));
 
$to = Mage::getStoreConfig('contacts/email/recipient_email', $websiteModel->getId());

The other change was a bit of a curve ball. I had a Magento + Gmail user named Matt contacted me with what seemed to be an unrelated issue. I have been poking around in the installation code trying to figure out what has been happening. It wasn’t until I did a full fresh install on Magento 1.3.2.3 that I noticed what was going on. My extension has a dependency on Mage_Core (obviously, right?) and the wiki guide on how to package Magento extensions says to include this dependency. However if you do then the downloader will download the Core files and a whole bunch of other required files. This is no problem if you have been a good boy or girl and made your changes to the themes outside of the default files, but if you have changed the default templates then there is a risk of your changes being lost!

So, the change is to remove this dependency, even though the guide says it should be there. It’s kind of obvious that you need Magento in order to run my extension anyway!

Magento SMTP support

The other update I wanted to post was that I am working on porting my Magento Gmail / Google Apps extension to also support full SMTP capability. I will be releasing the changes as a new extension, as it is important to me that the original goal of this extension (extreme simplicity and ease of use) is not lost under the weight of full SMTP configuration.

I know that there is already an older SMTP extension for Magento. I think I can improve upon it in several ways, I have developed Magento SMTP self test capability, and I have support for Magento newsletter sending. The current SMTP extension hasn’t been updated for nearly a year, and I have an opportunity to create a more modern, user friendly extension.

I’ll be working on it over the next few days and would invite feedback from anyone with ideas on ways to improve the Magento SMTP functionality.

Posted on

Using Gmail or Google Apps email with Magento

I was asked this week by a reader about using Google Apps email with Magento. There are solutions available that will allow you to configure the Magento SMTP server settings, or even your linux server SMTP settings so that you can use Gmail or Google Apps email to send outbound emails with Magento. In this post I will quickly cover a simple little open source Magento extension I made that makes setting up Gmail and Google Apps Email child’s play.

The Google Apps and Gmail Magento extension

You might be wondering firstly why you would want to use Google Apps or Gmail for your outbound emails from Magento.

  • Easier to set up a stable, secure and robust solution than if you try to run your own SMTP server.
  • Easy to administer with either the Gmail or Google Apps interface. You can set up auto replies, and auto forwards.
  • Excellent search capability for finding messages that have been sent to customers.
  • Acts as a log or archive of all emails sent by Magento, which means you can make sure it’s not sending any you do not want sent, and easily track any that are sent.

So hopefully everyone knows how sweet it is using a hosted ‘in the cloud’ email service, now on to how to do it!

Installation

You can install the module from Magento Connect by getting the extension key. Then using your store backend Magento Connect manager, you’ll need to change your settings to accept alpha modules (on the settings tab) and then just paste in the extension key and click install. Too easy. You can change the alpha back to stable afterwards, by the way.

Configuration

The Module is configured in the System -> Configuration -> System section. There are only three things to choose, so it’s very easy to setup.

Using Google Apps or Gmail with Magento is made easy with my purpose built Magento extension.
Using Google Apps or Gmail with Magento is made easy with my purpose built Magento extension.

It’s hopefully redundant, but for completeness here is some documentation:

The Enable Google Apps Email option allows you to turn the extension on and off easily. When enabled the extension will use your supplied Google Apps or Gmail credentials to send email from the Magento store.

The Email Address field is where you type the full address of you Gmail account or Google Apps account. It is important you type the whole address, even for Gmail where you might be more familiar with just entering a username.

Finally the Password field is where you type you Email account password. There is currently no way to test the connection (i.e. to make sure you have the right password) but that is planned functionality for a later release.

The Technical Details

The module is very simple, it’s just two Model files that overwrite the email sending functionality with Magento.

The key is in the setup of the Zend transport object as shown below:

public function getGoogleAppsEmailTransport() {
 
	$email = Mage::getStoreConfig('system/googleappsemail/email');
	$password = Mage::getStoreConfig('system/googleappsemail/password');
 
	$config = array('ssl' => 'tls', 'port' => 587, 'auth' => 'login', 'username' => $email, 'password' => $password);
	$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
 
	return $transport;
 
}

It’s annoying that for all the flexibility Magento allows, the way that the email sending has been coded really doesn’t allow much scope for extending the functionality without re-writing a sizable amount of Magento code. This means that maintenance becomes more difficult and the value of the inheritance structure is lost.

Setting up your Google Apps account

Sign up for a Google Apps account and then you’ll be able to create a ‘user’ to do your Magento email sending. In my current configurations I use email addresses like ‘mailer@xyzdomain.com’ or ‘no-reply@xyzdomain.com’. This means that to the end user the from email address will appear like a sophisticated CRM mailer, when in fact it’s just a free Google Apps account!

I also recommend setting the account up to forward a copy of all email to your own personal Gmail or Google Apps account. This way if any users do actually try to reply to the mailer address, the message will still make it to someone. If you wanted to you could even set up an auto responder that informed users to contact you in a preferred manner.

Feedback

I’d appreciate some feedback on this little module – I know the functionality exists elsewhere, but sometimes just making a good solution really easy for everyone, can be beneficial, hopefully you agree. If you spot any bugs or would like to suggest some new functionality, I’m all ears. Keen readers who check out the source code (which is totally open by the way) may notice I have some code in there for sending test emails, I just haven’t wired it up to the admin interface (backend) yet.