By Sudhanshu Raheja
In: Google Apps, Mail, Postfix, slicehost, ubuntu
17 Feb 2009We just moved to SliceHost recently and have been trying to get the server up and running. Every thing was super cool, but getting outgoing email to start working was a bitch.
What happens is that our poor little sendmail tries to be smart and deliver as much mail internally as possible. So even though the email address is set up to be used via Google Apps, sendmail tries to relay it internally and gets a ‘User unknown’.
This was confirmed by peeping into /var/log/mail.log and setting up a simple script in php which called the mail function. The user was never found, because we were looking at the wrong place.
Since I wasn’t prepared to spend a good part of the day on this thing, I decided to look out for options. After looking at a number of options, I decided to go ahead with ‘postfix’.
Let me take you step by step through the procedure :
1. As always, aptitude is there to help us out, so first we install postfix
sudo aptitude install postfix
2. During the installation, remember to choose the ‘Internet site’ option (because that is what you are doing. Right?)
3. Now that installation is done, it’s time to tell postfix that the domain is set up on Google Apps and not on the server (Actually we only tell postfix that the domain is not on the server). In the file /etc/postfix/mail.cnf we change the following
mydestination = mydomain.com, localhost.mydomain.com, localhost
to
mydestination = localhost.mydomain.com, localhost
4. Once that is done, just quit and restart (using sudo reboot) and you’re done.
In case you run into issues with the above, or find out a way to run this with sendmail, do let me know.
Gyaan Sutra is about entrepreneurship and technology. It is written and maintained by Sudhanshu Raheja, who is also the founder of Vercingetorix Technologies
4 Responses to Slicehost : Setting up outgoing mail and Google Apps (postfix)
Narendra.s.v
February 17th, 2009 at 9:03 am
Thanks for the information dude. My friends were speaking about slicehost. Will make them see this post ASAP.
Sudhanshu
February 17th, 2009 at 9:58 am
Glad to have helped Narendara. By the way, Slicehost is quite awesome, you should try it out.
Cheers!
Speakbnidas
April 29th, 2009 at 12:52 pm
Really good one. Thanks
Collin
December 7th, 2009 at 10:56 pm
Er, why would you reboot to finish installation?
sudo /etc/init.d/postfix restart