36

I followed the step described in the link below to setup my mac to send out email. http://www.anujgakhar.com/2011/12/09/using-macosx-lion-command-line-mail-with-gmail-as-smtp/

It was working fine on my Mac OS X 10.9. But after I upgraded to OS X 10.10. The mail.log showed the following error. What is the problem?

Oct 19 00:28:22 paullam-macbook-pro.local postfix/smtp[30383]: 6B47B8AD4E8: SASL authentication failed; cannot authenticate to server smtp.gmail.com[74.125.68.109]: generic failure
Oct 19 00:28:24 paullam-macbook-pro.local postfix/smtp[30383]: 6B47B8AD4E8: to=<zzpaul@gmail.com>, relay=smtp.gmail.com[74.125.68.108]:587, delay=3.4, delays=0.01/0/3.4/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server smtp.gmail.com[74.125.68.108]: generic failure)
TFS
  • 964
  • 1
  • 9
  • 19

4 Answers4

97

I had the same problem. A Google search turned up this link: http://hkitago.com/2014/09/yosemiteのpostfix設定/

It turned out I was missing the following line in /etc/postfix/main.cf:

smtp_sasl_mechanism_filter = plain
Josh
  • 986
  • 7
  • 2
  • 3
    This took me hours to stumble onto this, but great find, and quick fix – mlantz Nov 03 '14 at 08:29
  • Awesome answer. Thank you. I would have never figured this one out on my own. – Halfstop Feb 16 '15 at 20:12
  • 5
    All of you can read Japanese? For those of you find English easier to read, try [these instructions](http://www.iamafishnow.com/2014/11/02/set-up-smtp-gmail-to-work-with-php-mail-on-osx-yosemite/) instead. Also, I needed to turn on access for less secure apps within my Google account: https://www.google.com/settings/security/lesssecureapps. Probably not a good idea in general, but Google would not send my emails otherwise. Turn off access when you're done testing. – bergie3000 Jul 08 '15 at 07:16
  • Thank you @bergie3000 that "less secure apps" option was the missing piece of the puzzle for me. Thanks. – Manachi Nov 13 '15 at 05:09
  • 1
    This and using Google App Password got me going on Sierra. Thanks! – a. brooks hollar Apr 10 '17 at 20:44
  • @a.brookshollar using Google App Password with this and still not working. Any thoughts? – qodeninja Aug 24 '18 at 05:32
  • 1
    If someone got a error message like 'SASL authentication failed' or 'Application-specific password required', so you maybe use 2 factor authentication in Google. Check this tutorial to solve this problem (sat a special app password): https://davidwesterfield.net/2015/02/using-postfix-sasl-authentication-with-google-2-step-verification-on/ – Hermann Schwarz Jun 23 '22 at 09:17
8

I added both snippets as suggested, but still no luck. Then I found this article:

http://www.developerfiles.com/how-to-send-smtp-mails-with-postfix-mac-os-x-10-8/

and ran the following steps from it:

Step 2. Create the sasl_passwd file We need to create the sasl_passwd file with the SMTP credentials

sudo vi /etc/postfix/sasl_passwd

Write the following content exactly (don't put in your user address and password) and save:

smtp.gmail.com:587 your_address@gmail.com:password

Create the Postfix lookup table from the sasl_passwd file.

sudo postmap /etc/postfix/sasl_passwd

This will create the file sasl_passwd.db

Step 3. Restart Postfix To apply all new changes we have to restart Postfix:

sudo postfix reload

And still no luck. But then I noticed that relayhost in /etc/postfix/main.cf

was commented out with brackets like so:

relayhost = [smtp.gmail.com]:587

I changed this line to:

relayhost = smtp.gmail.com:587

reloaded postfix with:

sudo postfix reload

and postfix started sending email. Hooray!

konqi
  • 5,137
  • 3
  • 34
  • 52
esod
  • 335
  • 2
  • 9
  • 4
    Two problems with your answer: 1) You must enter your personal values for 'your_address' and 'password' in the step `smtp.gmail.com:587 your_address@gmail.com:password` 2) You misspelled `postfix` in the last step. Also, another thing I discovered - the key to everything, really - you must turn on access for lest secure apps in your Google account (https://www.google.com/settings/security/lesssecureapps). **Do all of this at your own risk!!!** – bergie3000 Jul 08 '15 at 07:11
  • Excellent link. Thank you @esod – arcseldon Aug 28 '15 at 00:25
  • Thanks @bergie3000 that sorted my issue. – Manachi Nov 13 '15 at 05:09
2

It turned out I needed another piece to get this to work.

sudo vi /System/Library/LaunchDaemons/org.postfix.master.plist

and right after this:

<dict>

add this:

<key>RunAtLoad</key>
<true/>

I can now send emails with Postfix on Yosemite!

Mitch Moccia
  • 519
  • 2
  • 8
  • 23
0

Answer by @Josh is working just fine (can lot leave comments on the answer), but using login as a filter would also work just fine. Not sure what the difference is, though.

As stated by the documentation page

Pjotr
  • 511
  • 5
  • 11