0

I want to use Postfix 2.11 on Ubuntu Server 14.04 LTS (only) to forward mails send to local user accounts to corresponding mailboxes using another SMTP server.

Configuration:

$ postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = loopback-only
inet_protocols = all
mailbox_size_limit = 0
mydestination = localhost mydomain.tld, myhostname, localhost.localdomain, localhost
myhostname = myhostname
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost = my-target-smtp-server
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

$ cat /etc/aliases
root: some-account@mydomain.tld

If I send a mail to the root user

$ echo "body"| mail -s "test" root

I see the following log entries in /var/log/mail.log

Nov  6 12:40:19 myhostname postfix/pickup[1854]: BD20144EC2: uid=0 from=<root>
Nov  6 12:40:19 myhostname postfix/cleanup[1898]: BD20144EC2: message-id=<20151106114019.BD20144EC2@myhostname>
Nov  6 12:40:19 myhostname postfix/qmgr[1855]: BD20144EC2: from=<root@mydomain.tld>, size=414, nrcpt=1 (queue active)
Nov  6 12:40:19 myhostname postfix/local[1901]: BD20144EC2: to=<some-account@mydomain.tld>, orig_to=<root>, relay=local, delay=0.15, delays=0.11/0/0/0.03, dsn=5.1.1, status=bounced (unknown user: "some-account")
Nov  6 12:40:19 myhostname postfix/cleanup[1898]: D21A344EC4: message-id=<20151106114019.D21A344EC4@myhostname>
Nov  6 12:40:19 myhostname postfix/bounce[1902]: BD20144EC2: sender non-delivery notification: D21A344EC4
Nov  6 12:40:19 myhostname postfix/qmgr[1855]: D21A344EC4: from=<>, size=2165, nrcpt=1 (queue active)
Nov  6 12:40:19 myhostname postfix/qmgr[1855]: BD20144EC2: removed
Nov  6 12:40:19 myhostname postfix/local[1901]: D21A344EC4: to=<some-account@mydomain.tld>, orig_to=<root@mydomain.tld>, relay=local, delay=0.07, delays=0.03/0/0/0.03, dsn=5.1.1, status=bounced (unknown user: "some-account")
Nov  6 12:40:19 myhostname postfix/qmgr[1855]: D21A344EC4: removed

So for what reason ever postfix won't use the relay server to forward the mail. If I removed 'mydomain.tld' from mydestination, mails are properly sent through the SMTP Server provided as relayhost, but all information in /etc/aliases is silently ignored: the mail is sent to root@mydomain.tld instead of some-account@mydomain.tld.

Do you have any idea what the problem might be?

1

I'm pretty sure you should remove "mydomain.tld" from mydestination. There also must be a comma between entries in mydestination (you have written localhost mydomain.tld).

Have you run the "newaliases" command after modifying /etc/aliases ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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