How to Setup Ubuntu Mail Server with Google Apps?
Easiest way to do this is to avoid using exim and to use sSMTP which is a lightweight MTA.
All you need to do is install it:
sudo apt-get install ssmtp mailutils
and configure it (edit /etc/ssmtp/ssmtp.conf) to use your Google Mail servers see:
[email protected]
mailhub=smtp.gmail.com:587
UseSTARTTLS=yes
UseTLS=yes
[email protected]
AuthPass=password
FromLineOverride=YES
I've been using this set-up for a while now and it just works - It's also nice to not need to be running exim when it's not necessary and let Google's mail servers handle everything for you.
Basically, it's very easy.
$ sudo dpkg-reconfigure exim4-config
Choose all things that make sense for you - as long as you choose something with a smarthost. When the question that asks you what smarthost to use comes, answer: smtp.gmail.com::587
Then edit the file /etc/exim4/passwd.client to match
gmail-smtp.l.google.com:[email protected]:p@sSw0rd
*.google.com:[email protected]:p@sSw0rd
smtp.gmail.com:[email protected]:p@sSw0rd
And that does the job.
ssmtp also works fine, but appeared rather slow for mail delivery. Also, I prefer to have a deamon to connect to.
Keep in mind that free version of GMail has an outbound limit of ~500 messages / day. If you don't exceed this limit muffin's solution would work great for you.
You should be able to use Google's mail servers as your SMTP gateway and authenticate with a user.
http://www.google.com/support/a/bin/answer.py?hl=en&answer=60730
Here's some basic psudocode to give you an idea:
smtpHost = smtp.gmail.com
smtpUsername = [email protected]
smtpPassword = your_password
smtpType = tls
smtpPort = 465
UPDATE:
Here's a link which might help a little. Its not EXACTLY what I was looking for but reasonable enough (I hope) to give you an idea that it is possible to have cron jobs send email via google apps.
http://bakingnoodles.com/tag/linux/
This little app might prove useful as well (warning: I have not tried it myself)
http://linux.softpedia.com/get/Communications/Email/Email-2-6805.shtml
Another option might be to configure Postfix to use Google Apps for all of your mail delivery. If you search google for "configure postfix google apps" you'll find a bunch of links, including this one:
http://blog.twinklesprings.com/2008/03/27/remote-mail-delivery-for-google-apps-and-postfix-mail-server/
If you don't need to receive mail, you really don't need to send it through Google. If you setup your DNS records correctly, you should be able to send mail from the MTA on the web server.
If you are using SPF you'll want to make sure you update it to include your application server.