Hello all,
I have a server on my home network and I'd like to do the following:
- Forward all mail to gmail (working)
- Alias the various system accounts to a user that exists on my gmail domain
Currently I am using google apps with my own domain, so mail to
me@mydomain.com goes to my gmail apps account, which I can check via
http://mail.mydomain.com or via imap, pop, etc.
With my current postfix settings I can successfully send mail to "me@mydomain.com", or to just "me" and postfix happily relays the mail to smtp.gmail.com.
The problem is with my /etc/aliases, I currently have:
root: me
However mail to "root" gets relayed to
root@mydomain.com instead of
me@mydomain.com, and since root is not a valid account in my google apps domain, the
me@mydomain.com user gets a bounceback sayins the root account does not exist.
Here is my postfix main.cf:
Code:
myhostname = myserver.mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = myserver.mydomain.com, localhost.mydomain.com, localhost
relayhost = [smtp.gmail.com]:587
mynetworks = 127.0.0.0/8 10.1.1.0/24
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
# TLS parameters
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_tls_cert_file = /etc/postfix/mydomain-cert.pem
smtp_tls_key_file = /etc/postfix/mydomain-key.pem
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_tls_CAfile = /etc/postfix/cacert.pem
smtpd_tls_cert_file = /etc/postfix/mydomain-cert.pem
smtpd_tls_key_file = /etc/postfix/mydomain-key.pem
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
# SASL parameters
smtpd_sasl_auth_enable = no
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtpd_sasl_local_domain = $myhostname
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
The contents of /etc/mailname are:
mydomain.com
When sending mail to root, the mail.log contains:
Code:
Oct 30 15:00:58 neon postfix/smtp[18939]: 37366340887: to=<root@mydomain.com>, orig_to=<root>, relay=smtp.gmail.com[74.125.47.108]:587, delay=2.3, delays=0.04/0.02/0.78/1.4, dsn=2.0.0, status=sent (250 2.0.0 OK 1320001277 o22sm20905675yhk.17)
As you can see, the mail is properly relayed to gmail however postfix is not honoring the /etc/aliases file, and sending the mail to
root@mydomain.com instead of
me@mydomain.com
If I fiddle with the myhostname, mydestinations, etc variables I can get postfix to honor the aliases file but then it stops relaying, and I see this instead:
Code:
Oct 30 14:38:50 neon postfix/local[18014]: 69DD0340887: to=<me@mydomain.com>, orig_to=<root>, relay=local, delay=0.06, delays=0.04/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Which obviously is not what I want, because since the mail was delivered locally I never get it in my gmail account.
Can anyone explain the steps necessary to get relaying working properly while still honoring the aliases, so that I can send mail to "root" (or more likely cron, etc) and have it relay through gmail and arrive at
me@mydomain.com's mailbox?
Thanks in advance!