Hello all,

I am attempting to relay mail from one of my systems to my gmail-hosted 
account.  This is working OK except for one catch:  mail sent to users whom 
have aliases in /etc/aliases do not get properly mapped to the correct user.

For example my /etc/aliases file has the following:

postmaster: root
root: brandon

Now, when I send mail to simply "brandon" postfix properly relays the message to my gmail domain 
(we'll call it mydomain.com) and I get the message in my bran...@mydomain.com inbox.  There is no 
r...@mydomain.com so I want to alias root to brandon, so that messages sent to "root" get mapped to 
"brandon" and then relayed to gmail and arrive in bran...@mydomain.com's inbox.

This is not working.  Instead, when messages are sent to "root" they are properly relayed 
however the aliases file is not honored and postfix tries to send the message to r...@mydomain.com 
instead, so gmail rejects the message since the "root" account in my google apps domain 
manager does not exist.

Below are my configuration files.  The mail server's hostname is "mailserver", 
the domain I have changed to mydomain.com.  Any help would be greatly appreciated.

/etc/postfix/main.cf:

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no

myhostname = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
transport_maps = hash:/etc/postfix/transport
myorigin = mydomain.com
mydestination = mydomain.com, mailserver.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/CP-cert.pem
smtp_tls_key_file = /etc/postfix/CP-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/CP-cert.pem
smtpd_tls_key_file = /etc/postfix/CP-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

inet_protocols = ipv4

/etc/postfix/transport:

* smtp:[smtp.gmail.com]:587

/etc/aliases:

mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: brandon

When I try to mail "root", here's what I get:
Oct 30 18:32:02 neon postfix/smtp[26096]: 23542340887: to=<r...@mydomain.com>, 
orig_to=<root>, relay=smtp.gmail.com[74.125.47.109]:587, delay=2.2, 
delays=0.04/0.04/0.76/1.4, dsn=2.0.0, status=sent (250 2.0.0 OK 1320013941 
c68sm22994052yhi.7)

As you can see, the alias was not used and mail was sent to r...@mydomain.com 
instead of bran...@mydomain.com

Reply via email to