Posted on

Gmail and Google Apps 500 emails per day sending limit and Magento

I’ve had a couple of fellow Magento users contact me over the last couple of weeks about the 500 emails per day Google Apps and Gmail limit. I’m sure it’s in the class of good problems to have when you have more than 500 order related emails, or new customer sign-ups everyday! In this post I’ll detail my simple solution to the 500 email limit that Google imposed on their Gmail and Google Apps accounts when you are using an account as your transactional email sending account for Magento.

First, the problem is that you can only send 500 emails per day through Gmail or Google Apps – that’s fair enough, the accounts are supposed to be suitable for humans, not Magento stores. Also, you can pay for premier and get 2000 emails, so that’s not too bad either for $50/user!

Never fear though, I have modified my extension to help out. Basically here is how the change works, and how it is implemented. You can get the new version over on Magento Connect

Update: you can’t at the moment, so download directly from me for the time being.

Update: Thanks to Paulius there is a specially packaged version of the extension that will make it easy to install manually until I can get the Magento Connect version updated (which is still failing). Get that version here!

What’s changed?

The changes are actually borderline trivial, I wanted this change to have no material effect on the interface, I’d hate to complicate the interface with more fields allowing multiple accounts to support only the handful of people who need this. So what I did was add the ability for the email field to be a comma-separated list of email addresses or a single address (the most common case).

That means the 99.5% of you who use just one account don’t need to care at all, in fact you could read something else more interesting at this point. For those that do want multiple accounts, simply add them in the email field comma-separated.

The simple code change is to allow for more than one and simply select one at random like so:

$email = explode(",", Mage::getStoreConfig('system/googlesettings/email', $id));
 
// We now allow a load balance of multiple gmail 
// accounts to get past the 500/day limit.
 
if (count($email)) {
 
	$email = $email[array_rand($email)];
} else {
 
	Mage::log(
		"No email configured - 
		you need to specify one in the magento configuration, 
		otherwise your connection will fail");
}

A nice side effect of this change is that now I report a helpful log message if for some reason you’re trying to use Gmail or Google Apps without specifying an email address in the Magento admin interface.

Now I know that this approach will not ensure that each account is used an even number of times, but I didn’t actually want to record how many times they had been used because I’m lazy. So if you need to send 980 emails per day, I’d suggest setting up 3 or 4 accounts, so that the pseudo-randomness does not affect your ability to send emails – seeing as there may not be a perfectly even distribution between the accounts.

How to set it up with Gmail or Google Apps

So how do you actually take advantage of this feature? Here’s how I envision it working, but I’d be open to suggestions if this is not going to be workable for some reason.

  1. Set up multiple mailer.n@yourdomain.com user accounts each with the same password
  2. Configure an auto forward rule for each mailer account to your actual sales@ email address – the one where replies should end up. This is just in case someone actually emails one of these addresses, though based on the next point – they shouldn’t
  3. Make sure you use the ‘use reply-to email addresses’ setting , so that despite the email being sent by the various mailer.n accounts, the replies from the customer should arrive to your standard CRM accounts.

So that’s my plan, get the new version and let me know if that will work for you or not and I can adjust it where required.

3 thoughts on “Gmail and Google Apps 500 emails per day sending limit and Magento

  1. Is this compatible with 1.4, and which of these should we use? There’s a link to a 1.0.1 and a 1.0.2b in this post.

  2. Hi, either version is 1.4 compatible – if you’re comfortable installing extensions manually then get 1.0.2 – Paulius’ version is not much different, but just a bit easier to extract (still requires manual install though). I’m working on a new release for Magento Connect – it won’t let me upload 1.0.{2,3,4…} but I have a 1.1 stream in development – I’m adding optional email logging, I see the paid SMTP extension being sold has that feature, can’t be outdone by the commercial folks!

  3. Ah, cool. I’ll go for the 1.0.2 then. I know how to install manually, but I just found your more recent post with the directory structure. I’ll paste here for others’ reference. Of course, once Magento Connect has it, this is moot. 😉

    `copy the Aschroder directory into $magento_base/app/code/community and the file in the modules directory goes into $magento_base/app/etc/modules , then just refresh your magento cache`

    Thanks for creating this, btw. So useful. As are your other posts… I pretty much read them all b/c they’re exactly what I (we all) need to do, e.g., your post on 3 easy steps to add categories to a cms page, I just reference that every time I need to do it.

Comments are closed.