LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-30-2012, 08:12 AM   #1
kirenpillay
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Rep: Reputation: Disabled
Postfix GMAIL relay not working


I'm trying to set up postfix relay access via SMTP using gmail using the many tutorials on the net. It looks as though I am missing a prerequites. I've reinstalled postfix a couple of times with the same issue.

Below are the logs.
1. The line that says relay=none indicates that the relaying to gmail isn't happening. Even though it says bounced, i doubt it is even getting there.
2. I tried telnet-ing into [smtp.gmail.com] on port 587 and it works, so not network issues.

Code:
Jun 30 14:59:43 Flash postfix/pickup[8848]: 3667B2D32B: uid=1000 from=<kiren>
Jun 30 14:59:43 Flash postfix/cleanup[8853]: 3667B2D32B: message-id=<20120630125943.3667B2D32B@Flash>
Jun 30 14:59:43 Flash postfix/qmgr[8849]: 3667B2D32B: from=<kiren@Flash>, size=328, nrcpt=1 (queue active)
Jun 30 14:59:43 Flash postfix/error[8855]: 3667B2D32B: to=<kp1@gmail.com>, relay=none, delay=0.02, delays=0.01/0/0/0, dsn=5.0.0, status=bounced ([smtp.gmail.com]:587)
Jun 30 14:59:43 Flash postfix/cleanup[8853]: 39CEA2D32D: message-id=<20120630125943.39CEA2D32D@Flash>
Jun 30 14:59:43 Flash postfix/bounce[8856]: 3667B2D32B: sender non-delivery notification: 39CEA2D32D
Jun 30 14:59:43 Flash postfix/qmgr[8849]: 39CEA2D32D: from=<>, size=1923, nrcpt=1 (queue active)
Jun 30 14:59:43 Flash postfix/qmgr[8849]: 3667B2D32B: removed
Jun 30 14:59:43 Flash postfix/local[8857]: 39CEA2D32D: to=<kiren@Flash>, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Jun 30 14:59:43 Flash postfix/qmgr[8849]: 39CEA2D32D: removed
My main.cnf

Code:
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_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 = Flash
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = Flash, localhost.localdomain, localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mynetworks_style = host
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
#inet_interfaces = all
default_transport = error
relay_transport = error

# sets gmail as relay
relayhost = [smtp.gmail.com]:587

#  use tls
smtp_use_tls=yes

# use sasl when authenticating to foreign SMTP servers
smtp_sasl_auth_enable = yes 

# path to password map file
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

# list of CAs to trust when verifying server certificate
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

# eliminates default security options which are imcompatible with gmail
smtp_sasl_security_options =


debug_peer_list=smtp.gmail.com
debug_peer_level=3
 
Old 06-30-2012, 08:49 AM   #2
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by kirenpillay View Post
....

My main.cnf

Code:
....
recipient_delimiter = +
inet_interfaces = loopback-only  <--- probably this limits every outside communication with your server
#inet_interfaces = all
default_transport = error
relay_transport = error    <--- see under "The variable default_transport specifies which transport is used to deliver non-local mail (by default smtp). ..."

# sets gmail as relay
relayhost = [smtp.gmail.com]:587
Hi, probably you have a problem where marked with red and click the links to see some troubleshooting.

Last edited by lithos; 06-30-2012 at 08:50 AM.
 
Old 07-08-2012, 01:35 PM   #3
kirenpillay
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hi Lithos,

I moved to exim4 and installed that with the smarthost configuration option and it worked first time for me.

I think choosing a postfix configuration with smarthost at postfix installation-time would have resolved the problem for me, but I haven't revisited this issue. I think the relay_transport setting may have been the problem but I don't have the time to confirm this.

Thanks for your help!
 
Old 07-14-2012, 05:08 AM   #4
kirenpillay
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Postfix [Solved]

Hi

I revisited this issue when I installed Mint 13. I chose the smarthost option when I installed postfix. Thereafter the following settings file worked for me.

I had another issue resolving MX records which where not working because of my router's DNS proxy. This was fixed by following link http://www.freespamfilter.org/forum/...hp?f=10&t=2049.

Quote:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# 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

# use tls
smtp_use_tls=yes

# use sasl when authenticating to foreign SMTP servers
smtp_sasl_auth_enable = yes

# path to password map file
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

# list of CAs to trust when verifying server certificate
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

# eliminates default security options which are imcompatible with gmail
smtp_sasl_security_options =



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

myhostname = Flash
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = Flash, localhost.localdomain, localhost
relayhost = smtp.gmail.com:587
relay_transport = error
inet_interfaces = all
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix SMTP relay via gmail using original sender email address? bdobolina Linux - Server 4 05-01-2012 06:21 AM
Postfix refusing relay (554), apparently authorization is not working. cchilaquil Linux - Server 12 01-12-2012 10:03 AM
Postfix with Centos 5.7 Gmail relay Must issue a STARTTLS command first j.smith1981 Linux - Server 2 11-26-2011 03:02 AM
postfix relay thru gmail NeptunEz Linux - Networking 17 12-09-2006 09:10 AM
Postfix for Gmail relay Sinedie Linux - Server 1 11-16-2006 11:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration