Slicehost : Setting up outgoing mail and Google Apps (postfix)

In: , , , ,

17 Feb 2009

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.

4 Responses to Slicehost : Setting up outgoing mail and Google Apps (postfix)

Avatar

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.

Avatar

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!

Avatar

Speakbnidas

April 29th, 2009 at 12:52 pm

Really good one. Thanks

Avatar

Collin

December 7th, 2009 at 10:56 pm

Er, why would you reboot to finish installation?

sudo /etc/init.d/postfix restart

:)

Comment Form

About this blog

Gyaan Sutra is about entrepreneurship and technology. It is written and maintained by Sudhanshu Raheja, who is also the founder of Vercingetorix Technologies

Photostream

    Drunk
    The Ivy In Store
    The old joint
    The setup
    Some light years earlier
    Wollongong

  • Collin: Er, why would you reboot to finish installation? sudo /etc/init.d/postfix restart :) [...]
  • nix: Stumbled into your blog post and I find it quite interesting. Now I have a comment or two; sorry to [...]
  • Narendra.s.v: That's interesting! But i guess Screwvala haven't raised there salaries and so they resigned ;) [...]
  • Brijesh: I think you should ask Screwvala to fill in their posts and you should take over as the head. Eve [...]
  • Manjunath: I too had a same feeling and wrote post in my blog about it there are many such similar sites who po [...]