We 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.
Thanks for the information dude. My friends were speaking about slicehost. Will make them see this post ASAP.
Glad to have helped Narendara. By the way, Slicehost is quite awesome, you should try it out.
Cheers!
Really good one. Thanks
Er, why would you reboot to finish installation?
sudo /etc/init.d/postfix restart
Finally!
I just spent the past two hours looking this up. Though I’m on Linode (rather than Slicehost), this worked like a charm. I was getting so frustrated. I was ready to just give up on the whole Google Apps + Postfix setup. Thanks for the help!
Pingback: I think installing PostFix solved my problem, but it seemed *too* easy Drija
Pingback: postfix (for sending mail only) multiple domain setup Drija
Sweet, works w/ slicehost and rackspace as well. Note if you recieve an error on using the mail command make sure you install mailutils under ubuntu 10.4.
Thanks.
I have been trying to set something up easily, this should work – will give it a try.
I am currently using ssmtp sendmail gmail on slicehost
Great, I found this to be the simplest setup. Do let me know if you have any issues.
I am using slicehost for my website builder tool.Your post helped me in solving a problem that i was facing.Thanks a lot.
Superb! just what I was looking for, works like a charm
Pingback: Use Gmail for incoming mail, and own mail server for outgoing email - Admins Goodies