Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Jul 31, 2013 4:52 pm 
Offline
Senior Newbie

Joined: Fri Jun 07, 2013 3:27 pm
Posts: 11
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
Code:
# 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_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
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 = 127.0.0.0/8 [::ffff:127.0.0.0]/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
Code:
admin@XYZ.com  gaccount@gmail.com





Thanks for the help!


Last edited by starboy on Wed Jul 31, 2013 5:44 pm, edited 1 time in total.

Top
   
PostPosted: Wed Jul 31, 2013 5:39 pm 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
Put that config file in between [ code ] and [ /code ] (remove the spaces) to make it easier to read. It's hard to tell it apart from your actual post.

If you're not using a database with Postfix, add your forwarding rules to /etc/aliases in the form of:
Code:
admin@xyc.com: gaccount@gmail.com

the run the newaliases command. If it still doesn't work, restart Postfix.

If you are using a database, you'll need to add your aliases to whichever database/table you're using for aliases, then restart Postfix (and maybe Dovecot if you're using it for authentication).

_________________
Kris the Piki Geeker


Top
   
PostPosted: Wed Jul 31, 2013 5:56 pm 
Offline
Senior Newbie

Joined: Fri Jun 07, 2013 3:27 pm
Posts: 11
Thanks for the reply Piki,

I just sent out a test email and didn't receive anything, but from the logs it looks like it went ok?
Code:
Jul 31 17:45:38 noble postfix/cleanup[4196]: 43493501B9: message-id=<CANHCpysOZOzcPG+Xe8NuNoKemgMtz3kzavo27Mi2Jt2ofnQVgw@mail.gmail.com>
Jul 31 17:45:38 noble postfix/local[4197]: 2CE42501B7: to=<XYZ@domain.com>, relay=local, delay=0.14, delays=0.13/0.01/0/0, dsn=2.0.0, status=sent (forwarded as 43493501B9)
Jul 31 17:45:38 noble postfix/qmgr[4175]: 43493501B9: from=<gaccount@gmail.com>, size=1849, nrcpt=1 (queue active)
Jul 31 17:45:38 noble postfix/qmgr[4175]: 2CE42501B7: removed
Jul 31 17:45:38 noble postfix/smtpd[4191]: disconnect from mail-oa0-f52.google.com[209.85.219.52]
Jul 31 17:45:38 noble postfix/smtp[4198]: 43493501B9: to=<gaccount@gmail.com>, orig_to=<XYZ@domain.com>, relay=gmail-smtp-in.l.google.com[173.194.74.27]:25, delay=0.58, delays=0/0.01/0.09/0.48, dsn=2.0.0, status=sent (250 2.0.0 OK 1375307138 a12si143361qeg.101 - gsmtp)
Jul 31 17:45:38 noble postfix/qmgr[4175]: 43493501B9: removed


Top
   
PostPosted: Wed Jul 31, 2013 6:20 pm 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
Sometimes there's a delay, especially when sending to or receiving from the larger email providers. It shouldn't take more than a few minutes.

If you don't receive it in your Gmail account soon, double check your log. Also double check your /etc/aliases file for typos.

_________________
Kris the Piki Geeker


Top
   
PostPosted: Thu Aug 01, 2013 9:18 am 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
If you forward messages from a Gmail account back to Gmail, they won't show up in your Gmail inbox. Gmail recognizes that it originated from your account and won't show it in the inbox.

Test by sending a message to admin@XYZ.com from another mail provider.

Edit: as a general rule, you should also run newaliases after editing a Postfix alias file. This generates the db file (which is what Postfix actually uses) from the text file.


Top
   
PostPosted: Thu Aug 01, 2013 11:11 am 
Offline
Senior Newbie

Joined: Fri Jun 07, 2013 3:27 pm
Posts: 11
So tried just tried using a different account, which again just let me get the email locally (still nothing forwarded). Checked the mail.log and this is what I'm getting:
Code:
Aug  1 10:46:34 noble postfix/cleanup[6478]: warning: database /etc/postfix/virtual.db is older than source file /etc/postfix/virtual
Aug  1 10:46:34 noble postfix/pickup[6450]: CA3B0501B9: uid=33 from=<www-data>
Aug  1 10:46:34 noble postfix/trivial-rewrite[6479]: warning: database /etc/postfix/virtual.db is older than source file /etc/postfix/virtual
Aug  1 10:46:34 noble postfix/cleanup[6478]: CA3B0501B9: message-id=<20130801144634.CA3B0501B9@mail.xyz.com>
Aug  1 10:46:34 noble postfix/qmgr[4175]: CA3B0501B9: from=<www-data@mail.xyz.com>, size=414, nrcpt=1 (queue active)
Aug  1 10:46:35 noble postfix/smtp[6480]: CA3B0501B9: to=<gaccount@gmail.com>, relay=gmail-smtp-in.l.google.com[2607:f8b0:400d:c02::1b]:25, delay=0.55, delays=0.01/0.01/0.06/0.46, dsn=2.0.0, status=sent (250 2.0.0 OK 1375368395 6si1750106qat.86 - gsmtp)
Aug  1 10:46:35 noble postfix/qmgr[4175]: CA3B0501B9: removed
Aug  1 11:03:27 noble postfix/master[2395]: daemon started -- version 2.9.6, configuration /etc/postfix


Top
   
PostPosted: Thu Aug 01, 2013 11:34 am 
Offline
Senior Newbie

Joined: Fri Jun 07, 2013 3:27 pm
Posts: 11
Found the issue.. Sadly forgot to point my (mail) MX subdomain to my A record.


Top
   
PostPosted: Thu Aug 01, 2013 11:54 pm 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
starboy wrote:
Code:
Aug  1 10:46:34 noble postfix/cleanup[6478]: warning: database /etc/postfix/virtual.db is older than source file /etc/postfix/virtual


This indicates that your changes to /etc/postfix/virtual are not being used and you need to run postmap hash:/etc/postfix/virtual to generate an updated virtual.db file.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group