My postfix install is set up to forward all email going to example.com to my other mail server at mail.example.net. This works fine for all addresses except !@example.com -- the example.com server spits out Illegal address syntax from in the logs and501 5.1.3 Bad recipient address syntax to the client,

How can I tell postfix to forward !@example.com as well? Wikipedia says that ! is valid for the local part.

My configuration is as follows:


alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = mail.example.com, localhost
relay_domains = example.com
myhostname = mail.example.com
mynetworks = [::ffff:]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_header_checks = regexp:/etc/postfix/smtp_header_checks
smtp_tls_fingerprint_digest = sha1
smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
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
transport_maps = hash:/etc/postfix/transport


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


/^Received: (from|by) mail\.example\.net/ IGNORE
/^Message-ID:\s+<(.*?)@mail.example.net>/ REPLACE Message-ID: <$1@mail.example.com>


mail.example.net fingerprint


example.com smtp:mail.example.net
  • 1
    Why do you want to do this? Oct 21 '14 at 0:28
  • Stylistic reasons, it fit in well with the domain name Oct 21 '14 at 15:51

Big Warning

Generally including special character like ! or % in the local part of an address is usually a bad idea. Exclamation mark a.k.a ! is a site separator in ancient UUCP addresses. For the safety, you should limit local part of email address to common characters such as [A-Z][a-z][0-9]-.+. It will preserve compatibility across other mailserver in this planet.

However if you insist to use the bang ! to alias, then you may change this parameter value in main.cf

swap_bangpath = no

References: here and here

  • Thanks! I've accepted your answer but unfortunately I'm unable to vote it up (low reputation) Oct 21 '14 at 15:49

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.