Currently I have installed, and configured postfix. If I send a email to let's say 'admin@XYZ.com' I receive the email(s) locally on the server. I would like to get these said emails to 'XYZ' to forward to my gmail account. Currently I have tried adding aliases through postfix to no avail.

Current postfix/main.cf

# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = mail.XYZ.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mail.XYZ.com, XYZ.com, localhost.XYZ.com, localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
virtual_alias_maps = hash:/etc/postfix/virtual
home_mailbox = mail/

Current postfix/virtual

admin@XYZ.com gaccount@gmail.com

You already have an alias map created, you can use that. Simply add the following to it:

admin: gaccount@gmail.com

Then run the newaliases command.

The result should now be that all emails thatshould be delivered to the local account "admin" will be instead forwarded to the specified gmail account.

  • Hi Urgoll, after checking the logs it looks to be working but never receive it in my gmail box? LOG: Jul 31 17:21:28 noble postfix/smtp[3965]: 85930501B9: to=<gaccount@gmail.com>, orig_to=<admin@xyz.com>, relay=gmail-smtp-in.l.google.com[2607:f8b0:400d:c02::1a]:25, delay=0.53, delays=0/0.01/0.07/0.45, dsn=2.0.0, status$ Jul 31 17:21:28 noble postfix/qmgr[3957]: 85930501B9: removed – Starboy Jul 31 '13 at 21:26
  • 1
    Have you checked SPAM folder? [ If messages ACCEPTED by gmail in SMTP session are not delivered at all then report a bug to gmail ] – AnFi Aug 1 '13 at 4:41
  • 1
    Starboy, do a grep of 85930501B9 in your maillog file. Postfix uses a multi-line format, and all lines are required to get the whole picture. – Urgoll Aug 1 '13 at 11:34

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.