Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am in the process of setting up postfix. I want it to send external mails through a GMail account and have followed the tutorial: http://rtcamp.com/wordpress-nginx/tutorials/linux/ubuntu-postfix-gmail-smtp/

It works fine when I am sending external mails!

However, when I try to send a local mail to myself:

test@desktop1204test:~$ echo "The body 1" | mail -s "Local to me" test

I get this unwanted result in /var/log/mail.log (only the 14:56 lines are relevant)

test@desktop1204test:~$ tail -n 6 /var/log/mail.log 
Sep  4 14:54:52 desktop1204test postfix/qmgr[3982]: 82DE9EFC4: removed
Sep  4 14:56:50 desktop1204test postfix/pickup[3983]: DE7B9CB21: uid=1000 from=<test>
Sep  4 14:56:50 desktop1204test postfix/cleanup[4565]: DE7B9CB21: message-id=<20130904125650.DE7B9CB21@desktop1204test.localdomain>
Sep  4 14:56:50 desktop1204test postfix/qmgr[3982]: DE7B9CB21: from=<test@desktop1204test.localdomain>, size=398, nrcpt=1 (queue active)
Sep  4 14:56:52 desktop1204test postfix/smtp[4567]: DE7B9CB21: to=<test@desktop1204test.localdomain>, orig_to=<test@desktop1204test>, relay=smtp.gmail.com[]:587, delay=1.9, delays=0.02/0.01/0.85/1.1, dsn=2.0.0, status=sent (250 2.0.0 OK 1378299412 f17sm10560634lbo.12 - gsmtp)
Sep  4 14:56:52 desktop1204test postfix/qmgr[3982]: DE7B9CB21: removed

It seems like it is letting smtp.gmail.com handle the message sending even though I am sending a local mail. I have relayhost = [smtp.gmail.com]:587 in my main.cf, but looking at the documentation for relayhost it says:

The next-hop destination of non-local mail; overrides non-local domains in recipient addresses.

And I am sending a local mail...

Here is my /etc/postfix/main.cf:

# TLS parameters
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = desktop1204test.farm, desktop1204test, localhost.localdomain, localhost
relayhost = [smtp.gmail.com]:587
mynetworks = loopback-only
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only

# From tutorial
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes


  1. Why is this happening and how do I fix it?
  2. I have never used local mail before. The only way I check if I got any mail is by issuing biff y when logged in as the test user. Is it enough or do I have to check it some other way? I just want to see if the mail arrived, to have a MUA installed is less important at the moment.
share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.