New here? Then you may want to subscribe to my rss feed. :)

[Updated] The problem with using Google Applications SMTP to send email

May 18th, 2007 | Posted in Google, Hints and Tips, Techy Talk | 5 Comments

Update - I was asked about which PHP scripts I use to send email via Google’s SMTP server. The most popular (or well known) one is PHPMailer, problem is that it doesn’t support TLS authentication. SwiftMailer does all that PHPMailer does with the added benefit of sending emails through Google.

You may already know that you can send emails from web forms using Google Applications SMTP server, which is really handy if you have your own VPS as a way of preserving resources such as memory and disk space when installing your own mail server and spam filtering software.

A minor problem with this is when sending emails from web forms using them as the SMTP server.

When emails pass through their SMTP server, the from and reply-to addresses are rewritten to the default one for that account. So if the default account is someone@somewhere.com and the generated email from your php script sets the from address to donotreply@mywebsite.com. By the time it appears in your Gmail inbox, the from address would have been replaced with someone@somewhere.com. This becomes a problem when downloading emails, Google POP server does not allow the download of emails where the from address is the same as the default account address. Bugger! (They do not make this very clear, tut tut)

The only way round this is to change the default email address for the account. But if you have several sites with several from addresses then this is not a viable solution.

A way to download emails via POP is to prefix your username with “recent:” like so:

recent:someone@somewhere.com

This works OK for me, but some people have had this download all emails, including junk. So test before committing to this.

Discuss this article »