1

I have set up Dovecot and Postfix using this tutorial, which works for receiving and sending mail. The aliases also work fine, although only for local users. I.e. I can make a forward from noaddress@mydomain.com to realaddress@mydomain.com, where only realaddress is defined as a virtual user (using MySQL). What I want to do is forward to an external address, such as Gmail or another mailserver. All my config-files are exactly as stated in the link above. I've tried adding

virtual_alias_domains =

to postfix/main.cf, but that didn't solve anything.

Also manually adding the domains there, i.e.

virtual_alias_domains = forwarddomain.com

didn't work. The error I get is

to=<contact@forwardomain.com>, orig_to=<contact@mydomain.com>, relay=mydomain.com[private/dovecot-lmtp], delay=0.07, delays=0.05/0.01/0/0.01, dsn=5.1.1, status=bounced (host mydomain.com[private/dovecot-lmtp] said: 550 5.1.1 <contact@forwarddomain.com> User doesn't exist: contact@forwarddomain.com (in reply to RCPT TO command)).

Output of postconf -n:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
content_filter = scan:127.0.0.1:10026
inet_interfaces = all
mailbox_size_limit = 0
mydestination = localhost
myhostname = mydomain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
receive_override_options = no_address_mappings
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/ssl/certs/dovecot.pem
smtpd_tls_key_file = /etc/ssl/private/dovecot.pem
smtpd_use_tls = yes
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
  • What's the error message when virtual_alias_maps was empty? Is it same as above? – masegaloeh Jan 16 '15 at 22:12
  • Yes, the error is exactly the same. – Ashwin van Dijk Jan 16 '15 at 22:32
  • The page of virtual_transport states that this is the default mail delivery transport final delivery to domains listed with $virtual_mailbox_domains. Did you add forwarddomain.com in virtual_mailbox_domains table? – masegaloeh Jan 17 '15 at 1:23
  • I added the forwarddomain.com there, but that doesn't make any difference: the error is the same. If I add the user it all works fine, as it is a local delivery, and the mail gets delivered. – Ashwin van Dijk Jan 17 '15 at 12:06
  • Can you enable debug_peer_list when postfix reject email? See postfix.org/DEBUG_README.html#debug_peer – masegaloeh Jan 20 '15 at 4:36
0

Finally found the answer, turned out postfix was trying to connect to gmail using ipv6. To fix this, configure ipv6 on the server, or like I did, disable ipv6 in /etc/postfix/main.cf by adding the following line:

inet_protocols = ipv4

and restarting postfix:

service postfix restart

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.