0

I'm currently trying to setup an SMTP-relay server to Gmail with Postfix on a CentOS 6.4 machine, so I can send e-mails from my PHP scripts.

I followed this tutorial but I get this error output when trying to do a

sendmail [email protected]

Output:

tail -f /var/log/maillog

Apr 16 01:25:54 ext-server-dev01 postfix/cleanup[3646]: 86C2D3C05B0: message-id=<[email protected]>

Apr 16 01:25:54 ext-server-dev01 postfix/qmgr[3643]: 86C2D3C05B0: from=<[email protected]>, size=297, nrcpt=1 (queue active)

Apr 16 01:25:56 ext-server-dev01 postfix/smtp[3648]: 86C2D3C05B0: to=<[email protected]>, relay=smtp.gmail.com[173.194.79.108]:587, delay=4.8, delays=3.1/0.04/1.5/0.23, dsn=5.5.1, status=bounced (host smtp.gmail.com[173.194.79.108] said: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 qh4sm3305629pac.8 - gsmtp (in reply to MAIL FROM command))

Here is my main.cf configuration, I tried a number of different options but nothing seems to work:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = localhost
inet_protocols = ipv4
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
myhostname = host.local.domain
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relayhost = [smtp.gmail.com]:587
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_type = cyrus
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
smtp_use_tls = yes
smtpd_sasl_path = smtpd
unknown_local_recipient_reject_code = 550

In the /etc/postfix/sasl_passwd files (sasl_passwd & sasl_passwd.db) I got the following (removed the real password, and replaced it with "password"):

[smtp.google.com]:587 [email protected]:password

To create the sasl_passwd.db file, I did that by running this command:

postmap hash:/etc/postfix/sasl_passwd

Do anybody got an idea why I can't seem to send an e-mail from the server?

Kind Regards Alex

1 Answer 1

2
# telnet smtp.gmail.com 587
Trying 173.194.70.108...
Connected to smtp.gmail.com.
Escape character is '^]'.
220 mx.google.com ESMTP h52sm28987766eez.3 - gsmtp
ehlo localhost
250-mx.google.com at your service, [46.4.15.52]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 CHUNKING

there is no auth available. You must use STARTTLS on port 25/587 or use SSL/TLS on port 465

smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
smtp_tls_security_level = secure
smtp_tls_mandatory_protocols = TLSv1
smtp_tls_mandatory_ciphers = high
smtp_tls_secure_cert_match = nexthop

/etc/postfix/tls_policy

gmail.com encrypt protocols=TLSv1 ciphers=high

/etc/postfix/sasl_passwd

[smtp.gmail.com]:587 [email protected]:password

In the maillog would be something like the following

# swaks -s 127.0.0.1 --helo localhost --to [email protected] --from [email protected]

# cat /var/log/maillog | grep 283AC120834
Sep 21 15:43:55 mail postfix/smtpd[28486]: 283AC120834: client=localhost[127.0.0.1]
Sep 21 15:43:55 mail postfix/cleanup[28489]: 283AC120834: message-id=<[email protected]>
Sep 21 15:43:55 mail postfix/qmgr[28481]: 283AC120834: from=<[email protected]>, size=449, nrcpt=1 (queue active)
Sep 21 15:43:56 mail postfix/smtp[28490]: 283AC120834: to=<[email protected]>, relay=smtp.gmail.com[173.194.70.108]:587, delay=1.7, delays=0.01/0/0.64/1, dsn=2.0.0, status=sent (250 2.0.0 OK 1379792594 y47sm29107298eew.12 - gsmtp)
Sep 21 15:43:56 mail postfix/qmgr[28481]: 283AC120834: removed

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .