Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have postfix on my Ubuntu 12. My server has real domain name (ddd). But I would like to use postfix for web scripts on my server to sending out emails.

My real domain name is connected with GMail. And it works well.

I have username on my server like xxx. And the same username I have on GMail (which is connected with my domain name ddd).

So when scripts from my server sending out email to user xxx@ddd it's sending it to local user xxx on my server ddd. But i would like to receive it on GMail.

is it possible ?

my MX record is Ok.

ddd.        3600    IN  MX  5
ddd.        3600    IN  MX  10
ddd.        3600    IN  MX  10
ddd.        3600    IN  MX  10
ddd.        3600    IN  MX  10
ddd.        3600    IN  MX  1
ddd.        3600    IN  MX  5

my main dns record is also good. my real domain name is resolved well.

share|improve this question

Don't use postfix; you have no need of its power and versatility.

Use a decent nullmailer such as ssmtp instead.

share|improve this answer
would it be enough to install just mailutils ? – user1016265 Apr 18 '12 at 13:20
That depends; a MUA such as mutt or (al)pine can send over SMTP, but mail(1) cannot. If you're going to use this for applications sending mail, just use a nullmailer. – adaptr Apr 18 '12 at 15:05

What you are doing is invalid. You created MX records for your domain that points to Gmail servers. You should receive the emails locally and then forward them to your Gmail account.

You can setup virtual alias maps in postfix to do so.

share|improve this answer
can I have installed just mailutils and not any big MTA ? – user1016265 Apr 18 '12 at 13:20

Firstly, make sure myhostname is set to a hostname within your domain, not your domain itself. Then, edit /etc/mailname (only works for Debian & Ubuntu) to have your domain, so myorigin will be set to this automatically. Finally, edit mydestination sot it doesn't contain $myorigin.

This will stop mail for your domain that should be going to Gmail from being delivered locally.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.