LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-13-2017, 10:07 AM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Rep: Reputation: Disabled
Sending emails with postfix and gmail - SASL authentication failed


Trying to send emails with sendmail on Centos6 using gmail as a relay, however, SASL authentication fails.

Package cyrus-sasl-plain-2.1.23-15.el6_6.2.x86_64 already installed and latest version.

Edited /etc/postfix/sasl_passwd as smtp.gmail.com GmailUsername:GmailPassword, and hashed.

Added the following to /etc/postfix/main.cf:
Code:
relayhost = smtp.gmail.com:587
#relayhost = [smtp.gmail.com]:587

smtp_tls_security_level = secure
smtp_tls_mandatory_protocols = TLSv1
smtp_tls_mandatory_ciphers = high
smtp_tls_secure_cert_match = nexthop
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
#smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
#smtp_sasl_mechanism_filter = login
#smtp_use_tls = yes
The response I get is:
Code:
May 13 07:31:33 devserver postfix/error[15419]: 42995200199: to=<toemail@gmail.com>, relay=none, delay=0.13, delays=0.09/0/0/0.04, dsn=4.7.14,
status=deferred (delivery temporarily suspended: SASL authentication failed;
server smtp.gmail.com[108.177.98.108] said:
534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=xxx?534-5.7.14 xxx-xxx?534-5.7.14 xxx-xxx-xxx?534-5.7.14 ShcA709Mb-xxx?534-5.7.14 xxx>
Please log in via your web browser and?534-5.7.14 then try again.?534-5.7.14  Learn more at?534 5.7.14  https://support.google.com/mail/answer/78754 xxx.77 - gsmtp)
As a last resort, I tried reducing gmails security per https://support.google.com/accounts/answer/6010255, but didn't help.

EDIT. I just changed /etc/postfix/main.cf form relayhost = smtp.gmail.com:587 to relayhost = [smtp.gmail.com]:587, and now I get the following. Looks like a good sign I hope.

Code:
May 13 08:57:11 devserver postfix/pickup[22206]: 40FA720012C: uid=500 from=<Michael>
May 13 08:57:11 devserver postfix/cleanup[22220]: 40FA720012C: message-id=<20170513155711.40FA720012C@example.com>
May 13 08:57:11 devserver postfix/qmgr[22207]: 40FA720012C: from=<Michael@example.com>, size=286, nrcpt=1 (queue active)
May 13 08:57:11 devserver postfix/smtp[22222]: 40FA720012C: to=<sendto@gmail.com>, relay=smtp.gmail.com[74.125.28.109]:587, delay=0.33, delays=0.12/0/0.18/0.03, dsn=5.5.1, status=bounced (host smtp.gmail.com[74.125.28.109] said: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1  https://support.google.com/mail/?p=WantAuthError 20sm13518391pfq.42 - gsmtp (in reply to MAIL FROM command))
May 13 08:57:11 devserver postfix/cleanup[22220]: CA431200138: message-id=<20170513155711.CA431200138@example.com>
May 13 08:57:11 devserver postfix/bounce[22225]: 40FA720012C: sender non-delivery notification: CA431200138
May 13 08:57:11 devserver postfix/qmgr[22207]: CA431200138: from=<>, size=2308, nrcpt=1 (queue active)
May 13 08:57:11 devserver postfix/cleanup[22220]: D393E20010E: message-id=<20170513155711.D393E20010E@example.com>
May 13 08:57:11 devserver postfix/bounce[22226]: 40FA720012C: sender delivery status notification: D393E20010E
May 13 08:57:11 devserver postfix/qmgr[22207]: 40FA720012C: removed
May 13 08:57:11 devserver postfix/qmgr[22207]: D393E20010E: from=<>, size=2107, nrcpt=1 (queue active)
May 13 08:57:11 devserver postfix/local[22227]: CA431200138: to=<Michael@example.com>, relay=local, delay=0.11, delays=0.04/0.04/0/0.04, dsn=5.1.1, status=bounced (unknown user: "michael")
May 13 08:57:11 devserver postfix/local[22228]: D393E20010E: to=<Michael@example.com>, relay=local, delay=0.07, delays=0.04/0/0/0.04, dsn=5.1.1, status=bounced (unknown user: "michael")
May 13 08:57:11 devserver postfix/qmgr[22207]: CA431200138: removed
May 13 08:57:11 devserver postfix/qmgr[22207]: D393E20010E: removed
What can I do?

Thank you

EDIT 2. Don't know what changed, but went back to relayhost = smtp.gmail.com:587, and now can send emails

Last edited by NotionCommotion; 05-13-2017 at 11:47 AM.
 
Old 05-26-2017, 03:13 PM   #2
kentyler
Member
 
Registered: Dec 2008
Location: Newark Ohio
Distribution: Fedora Core
Posts: 270

Rep: Reputation: 38
From the link that gmail sends in the error:

Allow less secure apps: If you don't use 2-Step Verification, you might need to allow less secure apps to access your account.
 
  


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 SSL - SASL LOGIN authentication failed: generic failure grambldouch Linux - Server 1 03-21-2014 08:50 AM
postfix SSL - SASL LOGIN authentication failed: generic failure grambldouch Linux - Server 1 09-26-2012 07:09 AM
Postfix/SASL/MySQL "SASL LOGIN authentication failed" Temujin_12 Linux - Server 8 10-04-2008 10:37 PM
Postfix - SASL LOGIN authentication failed micko_escalade Linux - Networking 1 02-03-2006 01:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:54 AM.

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