Postfix alias not forwarding email, no failure in log

Hi All,

Postfix doesn’t seem to be forwarding emails, not sure where to go from here. Everything else seems to work fine, but after creating an email alias, the logs say the email has been forwarded, but the email is never received.

That said, postfix and I have a long history of frustration. I should have known postfix would once more confuse and confound me.

  • Started with a fresh install of Debian Squeeze (fresh as in yesterday).
  • running virtualmin 3.94.gpl GPL (installed via install.sh)
  • all packages for OS & virtualmin have been updated (so postfix is 2.7.1)
  • virtualmin config has three virtual servers:
    • nerv.co: not used for anything other than nameservers, created a virtualserver for it so I could edit the zone.
    • foo.com.au: my small business, website & email services
    • bar.com.au: alias for foo.com.au
  • pretty much everything works as expected (aside from postfix). webserver, sql permissions, user logins, etc.

So… I want to avoid using actual mail boxes on this server. The plan is to forward all mail sent to james@foo.com.au to jamesbond@gmail.com and from there, send mail as james@foo.com.au. I’ve created an alias to redirect mail sent to james@foo to jamesbond@gmail, but no email is being forwarded. Whilst I can send mail from james@foo.com.au to jamesbond@gmail.com (via webmin interface), emails sent to james@foo.com.au don’t seem to be forwarded. I also tried the manual “send email via telnet” check here: http://wiki.debian.org/Postfix which worked without issue.

I created the alias in the “virtualmin” > “email aliases” section

I’m not certain what logs are really relevant, but here are some commonly asked for in other similar threads here. These logs are immediately after:

  • service postfix reload

  • service postfix restart

  • sending an email to james@foo.com.au

At some point I was getting a warning about hostname showing up in ‘mydestination’ and ‘postfix_mailbox_aliases’ or something. I checked the mydestination line in /etc/postfix/main.cf and it was something like:
nerv.co, localhost.co, , localhost”
I edited the config file through the webmin interface, and changed that line to
“localhost”
but next time I checked that line had somehow been changed to:
“$myhostname, localhost.$mydomain, $mydomain”
but I didn’t set it to that, and the warning is gone so…

Only other thing that seems weird is that no alias has been created in /etc/aliases, but the alias is definitely listed in virtualmin AND the alias must be somewhere because the mail.log shows the incoming mail being rerouted to the correct address.

So… any advice? Can someone point me in the right direction?

“postconf -n”

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
home_mailbox = Maildir/
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
mydestination = $myhostname, localhost.$mydomain, $mydomain
myhostname = nerv.co
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $mydomain
readme_directory = no
recipient_delimiter = +
sender_bcc_maps = hash:/etc/postfix/bcc
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
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
virtual_alias_maps = hash:/etc/postfix/virtual

“cat /var/log/mail.log |tail -n 20”

Oct 12 04:07:14 nerv postfix/smtp[6746]: 41C781A222C2: to=jamesbond@gmail.com, orig_to=james@foo.com.au, relay=gmail-smtp-in.l.google.com[173.194.79.27]:25, delay=1, delays=0.23/0.02/0.38/0.4, dsn=2.0.0, status=sent (250 2.0.0 OK 1350000434 e6si8895345paw.27)
Oct 12 04:07:14 nerv postfix/qmgr[6286]: 41C781A222C2: removed
Oct 12 04:07:43 nerv postfix/smtpd[6742]: disconnect from mail-oa0-f47.google.com[209.85.219.47]
Oct 12 04:10:06 nerv postfix/pickup[6285]: C80301A222C2: uid=33 from=
Oct 12 04:10:06 nerv postfix/cleanup[6888]: C80301A222C2: message-id=20121012001006.C80301A222C2@nerv.co
Oct 12 04:10:06 nerv postfix/qmgr[6286]: C80301A222C2: from=www-data@co, size=4528, nrcpt=1 (queue active)
Oct 12 04:10:07 nerv postfix/local[6890]: C80301A222C2: to=www-data@co, orig_to=, relay=local, delay=0.99, delays=0.27/0.02/0/0.7, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)
Oct 12 04:10:07 nerv postfix/qmgr[6286]: C80301A222C2: removed
Oct 12 04:11:03 nerv postfix/anvil[6481]: statistics: max connection rate 1/60s for (smtp:211.233.93.58) at Oct 12 04:04:27
Oct 12 04:11:03 nerv postfix/anvil[6481]: statistics: max connection count 1 for (smtp:211.233.93.58) at Oct 12 04:04:27
Oct 12 04:11:03 nerv postfix/anvil[6481]: statistics: max cache size 1 at Oct 12 04:04:27
Oct 12 04:11:39 nerv postfix/master[6279]: reload – version 2.7.1, configuration /etc/postfix
Oct 12 04:11:43 nerv postfix/master[6279]: terminating on signal 15
Oct 12 04:11:43 nerv postfix/master[7018]: daemon started – version 2.7.1, configuration /etc/postfix
Oct 12 04:12:22 nerv postfix/smtpd[7028]: connect from mail-ob0-f175.google.com[209.85.214.175]
Oct 12 04:12:23 nerv postfix/smtpd[7028]: 010781A222C2: client=mail-ob0-f175.google.com[209.85.214.175]
Oct 12 04:12:23 nerv postfix/cleanup[7033]: 010781A222C2: message-id=CA+qNkRoZ30r_f-mmooEhoMumNR3wd5rX0mi+CsZYczzddW66Gw@mail.gmail.com
Oct 12 04:12:23 nerv postfix/qmgr[7022]: 010781A222C2: from=jamesbond@gmail.com, size=2963, nrcpt=1 (queue active)
Oct 12 04:12:23 nerv postfix/smtp[7034]: 010781A222C2: to=jamesbond@gmail.com, orig_to=james@foo.com.au, relay=gmail-smtp-in.l.google.com[173.194.79.27]:25, delay=0.98, delays=0.22/0/0.37/0.39, dsn=2.0.0, status=sent (250 2.0.0 OK 1350000743 ax10si8469427pbd.284)
Oct 12 04:12:23 nerv postfix/qmgr[7022]: 010781A222C2: removed

“cat /etc/aliases”

Mail aliases for sendmail

You must run newaliases(1) after making changes to this file.

Required aliases

postmaster: root
MAILER-DAEMON: postmaster

Common aliases

abuse: postmaster
spam: postmaster

Other aliases

clamav: root

I’ve looked into this issue as exhaustively as I can, and couldn’t find a solution. I ended up working around it by having employees set their gmail to download email from this servers POP3 rather than just forwarding emails to their gmail addresses.

Having said that I did learn a couple of things which may or may not be useful to anyone else trying to work this out. With the above configuration I wasn’t getting any response after trying to forward emails to gmail. I tried forwarding to another email address of mine, and got a bounce message, and realised the from address in the forwarded emails was “james.foo@co”. I then discovered I’d messed something up horribly in my DNS settings essentially I’d named the machine ‘nerv.co’ instead of ‘somehost.nerv.co’. So… I did a complete reinstall of the OS & virtualmin (didn’t have any virtual servers anyway).

Thereafter I could forward emails to non-gmail accounts without issue, but forwarding to gmail accounts fails silently. Sending and receiving emails in usermin works fine.

Hope this is helpful to someone, sorry I didn’t find the solution.