toddgriham
15th June 2008, 20:55
Hi,
I'm trying to setup postfix on my server to relay outgoing emails to smtp.gmail.com.
Here's my configuration
/etc/postfix/main.cf
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
myhostname = myhostname.mydomain.com
mydomain = mydomain.com
myorigin = $mydomain
inet_interfaces = 127.0.0.1
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
mynetworks_style = subnet
mynetworks = 127.0.0.0/8
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.4.5/samples
readme_directory = /usr/share/doc/postfix-2.4.5/README_FILES
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject _unauth_destination
smtp_tls_per_site = hash:/etc/postfix/tls_per_site
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtpd_sasl_auth_enable = no
smtp_sasl_auth_enable = yes
smtp_sasl_type = cyrus
smtpd_sasl_local_domain = $myhostname
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_security_options =
smtpd_sasl_application_name = smtpd
smtp_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtp_tls_cert_file = /etc/postfix/ssl/smtpd.crt
smtp_tls_key_file = /etc/postfix/ssl/smtpd.key
smtp_tls_session_cache_database = btree:/var/run/smtp_tls_session_cache
smtp_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_auth_only = no
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_tls_session_cache_database = btree:/var/run/smtpd_tls_session_cache
tls_random_source = dev:/dev/urandom
relayhost = [smtp.gmail.com]:587
disable_dns_lookups = yes
smtp_generic_maps = hash:/etc/postfix/generic
transport_maps = hash:/etc/postfix/transport
/etc/postfix/sasl_passwd
[smtp.gmail.com]:587 myemail@gmail.com:mypass
/etc/postfix/transport
* smtp:[smtp.gmail.com]:587
/etc/hosts
"my public ip" myhostname.mydomain.com
127.0.0.1 localhost.localdomain localhost
When I try to send an email, it looks successful
/var/log/maillog
Jun 15 12:13:47 myhostname postfix/smtp[17854]: 54030249809E: to=<xxx@yyy.com>, relay=smtp.gmail.com[72.14.205.111]:587, delay=15, delays=0.06/0.05/1.5/14, dsn=2.0.0, status=sent (250 2.0.0 OK 1213546427 27sm882051qbw.19)
But in my gmail, I receive a bounce because google filters my email as spam
This is an automatically generated Delivery Status Notification
Delivery to the following recipient failed permanently:
xxx@yyy.com
Technical details of permanent failure:
PERM_FAILURE: Message rejected. See http://mail.google.com/support/bin/answer.py?answer=69585 for more information.
----- Original message -----
Received: by 10.150.123.16 with SMTP id v16mr8996608ybc.40.1213546416258;
Sun, 15 Jun 2008 09:13:36 -0700 (PDT)
Return-Path: <myemail@gmail.com>
Received: from myhostname.mydomain.com ( [my public ip])
by mx.google.com with ESMTPS id 27sm882051qbw.19.2008.06.15.09.13.34
(version=TLSv1/SSLv3 cipher=RC4-MD5);
Sun, 15 Jun 2008 09:13:34 -0700 (PDT)
Received: from myhostname.mydomain.com (localhost.localdomain [127.0.0.1])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(No client certificate requested)
by myhostname.mydomain.com (Postfix) with ESMTP id 54030249809E
for <xxx@yyy.com>; Sun, 15 Jun 2008 12:13:32 -0400 (EDT)
Received: (from root@localhost)
by myhostname.mydomain.com (8.14.2/8.14.2/Submit) id m5FGDWsW017848
for xxx@yyy.com; Sun, 15 Jun 2008 12:13:32 -0400
Date: Sun, 15 Jun 2008 12:13:32 -0400
From: root <myemail@gmail.com>
Message-Id: <200806151613.m5FGDWsW017848@myhostname.mydomain.co m>
To: xxx@yyy.com
Subject:
Since I saw a lot of posts saying that postfix relay to gmail works for them, the only reason I can think that can cause my mail to be rejected by google is DNS.
For those of you that were able to make this work, did you have to create an A record in DNS for myhostname.mydomain.com and a PTR record for reverse DNS.
If it's not DNS, any idea why my setup is not working
Thanks
I'm trying to setup postfix on my server to relay outgoing emails to smtp.gmail.com.
Here's my configuration
/etc/postfix/main.cf
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
myhostname = myhostname.mydomain.com
mydomain = mydomain.com
myorigin = $mydomain
inet_interfaces = 127.0.0.1
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
mynetworks_style = subnet
mynetworks = 127.0.0.0/8
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.4.5/samples
readme_directory = /usr/share/doc/postfix-2.4.5/README_FILES
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject _unauth_destination
smtp_tls_per_site = hash:/etc/postfix/tls_per_site
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtpd_sasl_auth_enable = no
smtp_sasl_auth_enable = yes
smtp_sasl_type = cyrus
smtpd_sasl_local_domain = $myhostname
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_security_options =
smtpd_sasl_application_name = smtpd
smtp_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtp_tls_cert_file = /etc/postfix/ssl/smtpd.crt
smtp_tls_key_file = /etc/postfix/ssl/smtpd.key
smtp_tls_session_cache_database = btree:/var/run/smtp_tls_session_cache
smtp_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_auth_only = no
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_tls_session_cache_database = btree:/var/run/smtpd_tls_session_cache
tls_random_source = dev:/dev/urandom
relayhost = [smtp.gmail.com]:587
disable_dns_lookups = yes
smtp_generic_maps = hash:/etc/postfix/generic
transport_maps = hash:/etc/postfix/transport
/etc/postfix/sasl_passwd
[smtp.gmail.com]:587 myemail@gmail.com:mypass
/etc/postfix/transport
* smtp:[smtp.gmail.com]:587
/etc/hosts
"my public ip" myhostname.mydomain.com
127.0.0.1 localhost.localdomain localhost
When I try to send an email, it looks successful
/var/log/maillog
Jun 15 12:13:47 myhostname postfix/smtp[17854]: 54030249809E: to=<xxx@yyy.com>, relay=smtp.gmail.com[72.14.205.111]:587, delay=15, delays=0.06/0.05/1.5/14, dsn=2.0.0, status=sent (250 2.0.0 OK 1213546427 27sm882051qbw.19)
But in my gmail, I receive a bounce because google filters my email as spam
This is an automatically generated Delivery Status Notification
Delivery to the following recipient failed permanently:
xxx@yyy.com
Technical details of permanent failure:
PERM_FAILURE: Message rejected. See http://mail.google.com/support/bin/answer.py?answer=69585 for more information.
----- Original message -----
Received: by 10.150.123.16 with SMTP id v16mr8996608ybc.40.1213546416258;
Sun, 15 Jun 2008 09:13:36 -0700 (PDT)
Return-Path: <myemail@gmail.com>
Received: from myhostname.mydomain.com ( [my public ip])
by mx.google.com with ESMTPS id 27sm882051qbw.19.2008.06.15.09.13.34
(version=TLSv1/SSLv3 cipher=RC4-MD5);
Sun, 15 Jun 2008 09:13:34 -0700 (PDT)
Received: from myhostname.mydomain.com (localhost.localdomain [127.0.0.1])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(No client certificate requested)
by myhostname.mydomain.com (Postfix) with ESMTP id 54030249809E
for <xxx@yyy.com>; Sun, 15 Jun 2008 12:13:32 -0400 (EDT)
Received: (from root@localhost)
by myhostname.mydomain.com (8.14.2/8.14.2/Submit) id m5FGDWsW017848
for xxx@yyy.com; Sun, 15 Jun 2008 12:13:32 -0400
Date: Sun, 15 Jun 2008 12:13:32 -0400
From: root <myemail@gmail.com>
Message-Id: <200806151613.m5FGDWsW017848@myhostname.mydomain.co m>
To: xxx@yyy.com
Subject:
Since I saw a lot of posts saying that postfix relay to gmail works for them, the only reason I can think that can cause my mail to be rejected by google is DNS.
For those of you that were able to make this work, did you have to create an A record in DNS for myhostname.mydomain.com and a PTR record for reverse DNS.
If it's not DNS, any idea why my setup is not working
Thanks