Posted on

New feature for Magento Gmail or Google Apps Email Extension

Just a quick note to say I have added some new functionality to the Gmail or Google Apps email sending extension I wrote for Magento.

Basically several people asked for reply-to functionality, that would use the Magento store addresses that were being used on the outbound email. The change was very minor, I guess I just didn’t see it as being important at the time. Anyway, it’s a configurable option now, so feel free to either use it or not. You can get the extension from Magento Connect.

The change for those interested was very small, just a simple reply-to header as shown below:

// If we are using store emails as reply-to's set the header
if (Mage::helper('googleappsemail')->isReplyToStoreEmail()) {
      $mail->addHeader('Reply-To', $this->getSenderEmail());
}

Also here are some screenshots showing the new configuration option and also how emails sent using the option or not using it.

The Gmail and Google Apps email configuration for Magento is very easy.
The Gmail and Google Apps email configuration for Magento is very easy.

You’ll notice no real changes here, just one new Yes/No option that if enabled will use the reply-to functionality shown below. Basically the reply-to email will be the one Magento is configured to use from the below Store email addresses screen.

This shows an example of some store email addresses configured in Magento
This shows an example of some store email addresses configured in Magento

These are the email addresses you will see in the reply-to field as shown in the examples below.

The default behavior is to send with no reply-to, as it seems the trend is toward automated emails that do not receive responses.
The default behavior is to send with no reply-to, as it seems the trend is toward automated emails that do not receive responses.

This image shows the default non-reply behavior, the from email is used as the to email for any replies.

This shows the new feature, a reply-to field that email clients will use to populate the reply to field.
This shows the new feature, a reply-to field that email clients will use to populate the reply to field.

This screenshot shows the use of the reply-to where Gmail will send the reply to the given email rather than back to the original sender address.

If you have any questions, feedback etc I’m always keen to hear it so please comment or contact me directly.

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.

Posted on

Nexcess Magento SIP Hosting Review

This is a Magento hosting review for Nexcess Hosting. Savy readers will recall, Nexcess sponsored my last Free Magento Hosting competition by giving away one year of free hosting on their entry level plan.

For this review I’ll be looking at the latest offering from Nexcess, the Magento SIP platform. This is a purpose built ecommerce hosting environment that is both secure and optimized. In this review I’ll look at what that security means, and also be running some tests for performance. I have a demo Magento SIP environment set up that you can try, to see for yourself how fast it is.

If you can’t be bothered reading the review below, my bottom line is; if you are prepared to spend the money, this is the fastest, most convenient Magento hosting solution I have seen to date, get it here.

Continue reading Nexcess Magento SIP Hosting Review

Posted on

Magento javascript 404 breaks Admin menu…solved!

This is just a quick post about the Magento javascript giving a 404 error because it tripped me up and really shouldn’t trip anyone up. Basically the problem is the javascript include in Magento that looks like the one below gives a 404 error and causes javascript errors on the page:

<script type="text/javascript" src="http://example.com/js/index.php?c=auto&amp;f=,prototype/prototype.js,prototype/validation.js..../>

The problem

Trying to load the javascript URL directly in a browser gives a 404 error, which in turns breaks everything javascript related in Magento. For example the checkout page will no longer work, the Magento admin menus do not display which then causes the whole admin interface to be unusable.

The fix

Set the correct permissions on the javascript files in you Magento installation.

cd /path/to/your/magento/
chmod -R 755 js/*

That should get the javascript files showing up again without the 404 error, and once they are, your Magento admin interface, add to cart, checkout and everything else that relies on javascript, will also work, yah!