I recently upgraded my Mac to use Apple’s latest operating system, Mountain Lion, and in so doing, wiped out my postfix configuration that I had previously set up with advice from many different blogs. Postfix is essential for my line of business where I send many emails through MAMP on my local machine.
After hours of updating settings and getting nowhere, I stumbled across a blog post that set me in the right direction.
Rather than do this process again when Apple releases a new upgrade, I decided to document the steps I took to get this working (more for a reference for myself, but also to help those with the same issues).
I personally use Google Apps, so this process is for those also trying to authenticate through Gmail. This process is much simpler if you don’t need SSL encryption when sending mail. I use TextMate as a text editor, so the following command line options use the ‘mate’ command. Alternatively, you can use ‘vi’, ‘vim’ or ‘nano’ depending on what you are familiar with.
Step 1
First, we need to create a Simple Authentication and Security Layer (SASL) password file. To do this, open up Terminal and enter in the following command:
1 | sudo mate /etc/postfix/sasl_passwd |
You will be required to enter your root password to edit the file. Enter in the following information, replacing <[email protected]> with your google apps username and domain or your gmail account, and <password> with your password:
Save and exit.
Step 2
Next, we need to create a postfix lookup for our new SASL password file. To do this, type the following command in the Terminal:
1 | sudo postmap /etc/postfix/sasl_passwd |
Step 3
Then we need to configure Postfix’s main.cf file which has all the configuration information for Postfix. I would recommend backing up this file in case anything happens. The first line of the following commands does just that, by creating a copy before editing it:
1 2 | sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.orig sudo mate /etc/postfix/main.cf |
Most of the information here is commented out. You just need to scroll down to the bottom and paste in the following lines:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Minimum Postfix-specific configurations. mydomain_fallback = localhost mail_owner = _postfix setgid_group = _postdrop relayhost=smtp.gmail.com:587 # Enable SASL authentication in the Postfix SMTP client. smtp_sasl_auth_enable=yes smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd smtp_sasl_security_options= # Enable Transport Layer Security (TLS), i.e. SSL. smtp_use_tls=yes smtp_tls_security_level=encrypt tls_random_source=dev:/dev/urandom |
Save and exit.
Step 4
At this point, we just need to start up Postfix with our changes. Use the following command:
1 | sudo postfix start |
If you entered in any information incorrectly in the main.cf file, this may throw errors. Fix the errors and then reload Postfix:
1 | sudo postfix reload |
Step 5
You can test this configuration by sending a test email from Terminal:
1 | date | mail -s test [email protected] |
If all goes well, you should receive an email to your inbox.
Step 6
Once you have everything working, you can set Postfix to start on boot by adding a key to /System/Library/ LaunchDaemons/org.postfix.master.plist file.
The key to add is:
1 2 | <key>RunAtLoad</key> <true/> |
The updated file looks like this (text version below):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.postfix.master</string> <key>Program</key> <string>/usr/libexec/postfix/master</string> <key>ProgramArguments</key> <array> <string>master</string> <string>-e</string> <string>60</string> </array> <key>QueueDirectories</key> <array> <string>/var/spool/postfix/maildrop</string> </array> <key>AbandonProcessGroup</key> <true/> <key>OnDemand</key> <true/> <key>RunAtLoad</key> <true/> </dict> </plist> |
And that’s it! You should now be able to send mail using Mac OS X and Postfix from a PHP install. I am not an expert at this by any means, but feel free to leave a comment below letting me know if this helped you or if you have any issues with it. I would be glad to help in any way I can!
You, sir, are a genius. I finally got PHP mail() working on my Mac. I cannot thank you enough.
Glad to be of assistance!
can u do postfix with rails action mailbox
The postfix config doesn’t seem to work. When I use the last command,
date | mail -s test [email protected]
I replace the [email protected] with mine, doesn’t send me an email. Any thoughts?
Hi thanks for your article. I’ve followed every steps from this tutorial; but it doesn’t work on my Laptop… so I went ahead and followed the blog post you mentioned at the start of the message, but also doesn’t work.
I also googled this post:
http://slashusr.wordpress.com/2012/02/14/enabling-postfix-for-outbound-relay-via-gmail-on-os-x-lion-11/
Still it doesn’t work. I’m having this error message when I enter “mail” command to check new mail:
: host smtp.gmail.com[209.85.225.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
aa4sm11414435igc.15 (in reply to MAIL FROM command)
Do you have any idea with it?
songyy,
I am not sure what the issue is. As long as you are following all the steps correctly, it should work for you. Gmail is a secure mail server and requires authentication, but the above steps should do the trick. Have you confirmed that your credentials are correct?
I know this is a late reply, but for any additional searchers:
1. I don’t know if you need to do this, but it seemed to make a difference after you change the password file rerun: sudo postmap /etc/postfix/sasl_passwd
2. If you have enabled 2-step authentication make sure you generate a application password to use instead of your normal password
Anyway those were just thigns that *seemed to get mine running.
@Benjamin, kudos for a great guide.
@Mark, high five for clarifying the need to generate and use an app-specific password for those of us (everyone, nowadays, right?) using 2-factor auth.
THANKS, BOTH OF YOU!
Wow, best guide for configuring postfix on OS X yet I’ve read. So straight forward and easy to read, and everything worked as expected the first time.
Great job!
Thank you, this is exactly what I’ve needed. Now I just need to figure out how to use this to send email via Java’s Mail api 🙂
Hello,
i use Mountain Lion with the Server Application.
looking in the mail.log file, i just realized that MacOSX Server didn’t set all rights like i should do…
1. look in the log file
tail -f /var/log/mail.log
2. if you get this message, you have the same problem that i had
Oct 3 11:48:54 MacOsX.Server postfix/postfix-script[59779]: warning: not owned by _postfix: /Library/Server/Mail/Data/mta/./guid_device_maps.plist
3. check the rights and privileges of the file guid_device_maps.plist
sudo ls -al /Library/Server/Mail/Data/mta/./guid_device_maps.plist
-rw-r—– 1 root mail 181 Sep 18 07:40 /Library/Server/Mail/Data/mta/./guid_device_maps.plist
4. change the owner to _postfix user
sudo chown _postfix /Library/Server/Mail/Data/mta/./guid_device_maps.plist
5. check your changes 😉
sudo ls -al /Library/Server/Mail/Data/mta/./guid_device_maps.plist
-rw-r—– 1 _postfix mail 181 Sep 18 07:40 /Library/Server/Mail/Data/mta/./guid_device_maps.plist
6. open the Server Application, go to Email, check the Authentication method, i set it as “Automatic”
7. finally restart it switching on/off
sorry if the description isn’t 100% correct, i have my system in german, but i think you know what i mean…
regards
I’m getting warning: database /Library/Server/Mail/Config/postfix/virtual_catchall.db is older than source file does anyone how to fix it ?
Thank you, Thank you .. ohh and by the way .. THANK YOU!!!!!
Worked great. Thanks!
Clear and concise. In my case, I had to follow instructions from here too – https://discussions.apple.com/thread/4136501?start=0&tstart=0.
But all in all, I got it working in under 15 mins.
Thanks a bunch.
SS
It worked. Thank you so much for the detailed information.
Perfect, works fine !!
Thanks a lot man
Hi ben
I’ve tried your config tutorial and I’ve been unsuccessful.
I wanted to run it by you to see if I’m just missing a simple step.
I’m using MAMP
1. I changed the settings in the php.ini file to
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = [email protected]
; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
;sendmail_path =/usr/sbin/sendmail -t -i -f [email protected]
2. I created the sasl_passwd in the postfix directory adding this text
smtp.gmail.com:587 :
3. added the text you recommended to the master.cf file
4. I tried to run this code from terminal and looked in gmail but nothing posted in the inbox or in the spam folder.
date | mail -s test [email protected]
5. I also tried to run a test php mail() through MAMP and received this apache error code
[Mon Jan 07 00:11:29 2013] [notice] Digest: generating secret for digest authentication …
[Mon Jan 07 00:11:29 2013] [notice] Digest: done
[Mon Jan 07 00:11:29 2013] [notice] Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8r DAV/2 PHP/5.4.4 configured — resuming normal operations
[Mon Jan 07 00:11:39 2013] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
I’m not really sure where I’ve gone wrong on this, I imagine its something basic, but I’m not sure if it’s a setting in gmail or I’m just missing a step.
any help would be appreciated.
best,
SAM
Sam,
For the recored, I am also using MAMP, but didn’t change anything within the MAMP configuration (php.ini or anywhere).
On your step 2, did you put in your Gmail email and password? Or did you just have a blank : ?
When sending mail from terminal, try sending it to a different email address then the one you are sending from, just to make sure that everything is working right.
Nice one. Worked a treat!
hello guys. i have used this example and it worked fine until the step 5. when i used a simple example in my code
$txt = “First line of text\nSecond line of text”;
$txt = wordwrap($txt,70);
mail($toemail,”My subject”,$txt);
is still not working. im having this error message “Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.” how i can fix it? thank you
George,
This sounds like an external problem, not related to the Postfix issue. Are you still getting this error? Were you able to figure it out?
any idea why i am getting this?
Macs-MacBook-Pro:postfix Mac$ sudo postmap smtp_sasl_passwords
postmap: warning: smtp_sasl_passwords, line 1: expected format: key whitespace value
postmap: warning: smtp_sasl_passwords, line 3: expected format: key whitespace value
postmap: warning: smtp_sasl_passwords, line 4: expected format: key whitespace value
postmap: warning: smtp_sasl_passwords, line 5: expected format:
my smtp_sasl_passwords file has:
smtp.gmail.com:587 [email protected]:mypass
super,
I am not sure why you are getting these messages, but if you copied and pasted anything, I would try removing all text from the file, and typing it in by hand. That way if there are hidden characters that are causing these errors, they will be removed.
Thanks for your help in configuring Postfix, gave me the pointers I needed to get my mail command working with our security policies at work
Thank you so much!
Thank You So much!!!
Just a last question, the file /etc/postfix/sasl_passwd what kind of permission should have? It is safe to keep the password in that file whithout changing permission and/or owner?
Thank you again!
matteo,
My current sasl_password file is set pretty secure. It is a system file so I have it set to system permissions. My local username does not have access to it and I can only edit it with administrative access.
Awesome! Works perfect! Thank you!
Finally, it works! Thanks 😉
Does this allow you to send email within MAMP via SMTP as well? For instance, when using MAMP and the Swift Mailer library with the SMTP transport.
I’ve been trying and so far have no luck:
host: smtp.gmail.com
port: 587 // also tried 25 & 465
encryption: tls
username:
password:
Jason,
This method does incorporate SMTP directly through the google account. This is how I am sending out the messages in the first place, as you can see through step 1. My SMTP address is set with my username and password for authentication.
Thank you very, very much Benjamin for your clear, precise instructions.
I followed your instructions to the letter, and only encountered one problem at the very end when I attempted to start up postfix.
The problem was that there was no “spool” directory. However, a quick Google search showed me exactly what I had to do in order to create it.
Once I created the “spool” directory, postfix began working just great.
Once again, thank you so very much sir for saving me hours of needless hassle and headaches. 🙂
EXCELLENT! ….Worked like a dream, much appreciation. Thank you
Worked like a charm! thanks
That was so helpful,
thank you very much!!
Wish I had found this an hour ago … thank you!
I’ve been trying to do this for days and I keep getting the same error in terminal after step 4.
postfix: fatal: chdir(/Library/Server/Mail/Data/spool): No such file or directory
Can anyone help with this.
got in working thank you, thank you
I just implement the methods specified above and worked like magic. although I have been using a different tutorial before on my Snow Leopard, now I just got a new mac mini and set it up for my web development workhorse. Now can use local development as for Email function testing. thanks and definitely worth a space on my bookmark!
Awesome, working. Thanks!
you have just saved my day! thanks dude!
Worked like a charm! Thank 🙂
Dear Ben,
thank you for your post. I found something relevant at http://blog.deversus.com/2012/07/fix-for-postfix-in-mac-os-x-10-8-mountain-lion/#comment-18035 , by MIKE WALSH on JULY 26, 2012
where in combination with your post, i finally solved my problem
I followed your post but i stuck, at step 5.
Then at by MIKE WALSH’s post at the end i noticed the source of my problem (error: sendmail: fatal: chdir /Library/Server/Mail/Data/spool: No such file or directory). Then I followed the instructions there and I created the directory /Library/Server/Mail/Data/spool
and then the problem for me was solved !!
Anyway.., Thank you (both you and MIKE) so much
Theodoros
Thanks ! It works fine.
Nice!
bookmarked forever. Thanks for sharing your experience.
Can some please explain then how all emails to my system are being routed to /var/mail/ file? (Thus, when routed there, the user’s Mail never receives them since it’s not with the regular MAILDIR directory – and no, moving them there, or link to it does not work -> I tried)
This has me befuddled and wanting to shoot the computer. I have NOT set:
# DELIVERY TO MAILBOX
#
# The home_mailbox parameter specifies the optional pathname of a
# mailbox file relative to a user’s home directory. The default
# mailbox file is /var/spool/mail/user or /var/mail/user. Specify
# “Maildir/” for qmail-style delivery (the / is required).
#
#home_mailbox = Mailbox
#home_mailbox = Maildir/
If I turn on the “Maildir/” option -> then mail is routed to /Users//Maildir
I cannot for the life of me get it to route to where the IMAP daemon is reading it’s files. I can verify that when I send from one user to another on my system (from outside the domain) – the .SENT MESSAGES folder DOES show the email being sent – so it does find those in the MAILDIR structure – it’s only when sending out that it doesn’t work.
Is there some parameter, setting, blessing to some mail goddess that will get this to correctly route out?
I really need some help here.
If you need to see my main.cf -> please let me know and I’ll forward it – but I can assure you, I’ve bareboned it as much as I can to no avail.
thanks.
Joe…
Fixed. For those who want to know how – look at this configuration in
main.cf
(that file is in: /Library/Server/Mail/Config/postfix)
The item is:
mailbox_transport = dovecot
Seems in the migration from whatever to 10.8, that item is commented out and not set to a default setting. Unfortunately, postfix on Server uses dovecot to actually deliver the messages to the Maildir directories. So, since this wasn’t set, postfix had no way to figure out how to get it to the correct user (who’s directory is really their GUID)…
Here’s a quick test: enable to two accounts on your box. Then from out side, have account Bob send to account Alice.
Now, go to Bob’s Maildir -> this will be located in:
/Library/Server/Mail/Data/mail/
(you need to determine his GUID – I did it the hard way by looking at the messages in the accounts until I found the ones that matched my user name – there’s another way people said to do it, but it never worked for me)
Anyway, back to our regularly scheduled explanation: now, look in Bob’s Maildir under his .Sent Messages directory. In there you should see a corresponding message saying he sent the message.
Go back to Alice’s Maildir and look under the “cur” or “new” directory. If the message from Bob isn’t there – then dovecot is not routing correctly.
To find out where it’s routing – there are 3 possibilities:
1) it’s under /var/mail/ (note: not GUID – their account name) – and it’s all in one file – this uses the old style pre-Maildir format for storing the Inbox messages.
2) It’s under /Users//Maildir – in this case, postfix has given it to dovecot, but dovecot can’t figure out how to handle it – or, you’ve enabled home_mailbox = Maildir/ in main.cf.
(this is bad. For ML you don’t need to set this, the server admin does this automatically – and when you turn this on this way, the routing ends up in that setup.
3) It’s somewhere else on your machine – and this one is probably related to the imap:default_partition setting – go check that out by looking at:
serveradmin settings mail:imap
Anyway, any of those three are bad – all you really need to do is set the setting above to get the transport agent working correctly.
Just as an aside, the way I kinda think of things (someone will probably slam me for this analogy, but hey, it’s my head and it works) – postfix is the USPS – it handles getting mail and putting them to the correct post office. Getting it to your door (your inbox) is handled by dovecot. IMAP is nothing more than reading those directories for new items.
Hope this helps someone else – especially since it took me almost three days of constant researching to finally find out what was wrong with my mail.
I can post my main.cf if anyone cares -just shoot me an email.
Joe…
Hi, just a simple and maybe dumb cuestion. Do I need MAMP to make this work?
No, You do not need MAMP. This is just the configuration I used in conjunction with MAMP.
I also recommend to execute that command after creating password file:
The chmod go-rx sasl_passwd removes the group and other/world read/execute permissions on the password files. Only the root user should be able to read it.
Can anyone help me clear up the Mountain Lion Server requirements and conflicts?
Sorry for my apparent ignorance and confusion. I want to clean things up and make mail work again.
On Lion Server all was well. Since upgrade to ML Server I cannot get mail (“mail -s …..” from command ine) to send.
ON ML Server there are 2 separate paths to very similar files:
a. /etc/postfix
b. /Library/Server/Mail/postfix
On an ML Server:
1. Which path is being read?
2. How can I tell?
3. Can I safely ignore or remove one of these paths?
4. How can I choose the path least likely to be mucked up by the next OS update?
Thank you for your help.
-alan
Hello! I just would like to give an enormous
thumbs up for the great data you could have
right here on this post. I can be coming again to your blog for more soon.
God bless You !!!!
To get postfix to start on boot on my Mountain Lion computers I needed to change the OnDemand from true to false. After that, it starts on boot, every time
You sir are the dude \m/.. Thanks..
Thanks for the awesome post, tried many other ways to get mail working with MAMP and this post was the only one that actually worked.
You could simplify this by guide by replacing steps 1 and 2 with writing this into the main.cf:
smtp_sasl_password_maps = static::
It sidesteps the need for a user/passwd file by embedding it directly into the main.cf.
Dude, this has saved me so much time, you’re a legend!
WTF is mate???
Textmate. I used BBEdit instead.
I only got as far as step 2… it said “Permission denied”
Bercana,
Sorry for the late reply. Did you ever get this working? Sounds like this is an issue with sudo not working properly. Did you use the correct password to get sudo access?
Upgrading to Mavericks prevents postfix from working for some reason. Of course this happens right before a very important demo. I spent serveral days trying to restore email, until I found this article.
Thank you very much for taking the time to share your knowledge and experience. You have no idea how much it can mean to the person on the other side of those words.
Thank you, clear and concise, who could ask for more!
I wanted to add my thanks!! Your instructions worked great, and saved me lots of time!
Seriously, thanks for this article. You saved me what would have been days of headaches. Much appreciated!
Thanks for the instructions, worked perfectly on Mountain Lion 10.8.5.
You’re a fucking genius. You made my day. Thanks!
This is great, but when I do all that mail does not return an error message, but fails to send. The file /var/log/mail.log just has many copies of the message postfix/tlsmgr[11408]: exiting to reopen external entropy source dev/urandom
Suggests some problem with the dev/urandom thing, but I cannot tell what. Any suggestions?
Thanks mate. It work like a charm on Mac OSX 10.9.1
It doesn’t work.
When I send mail I see it in queue (using mailq command)
in mail.log i got this:
connection refused
TLS is required, but our TLS engine is unavailable
connect to smtp.gmail.com:587: No route to host
I have a Mac Book with Mac OS X 10.9.1
It’s pretty new and I have never touched any other config file
Any suggestions?
Fixed! The problem was connected to a previous configuration of MAMP PRO.
It was infact creating a custom main.cf file which had some wrong parameter.
I have just restored the original file and followed the instructions above and bang! that’s it!
Thanks for the tip!
It helped me: thanks!
Not too many howtos out there, where every step functions. Well done. Respect!
Thanks for the well written, informative article, man. Helped get me through struggle after having upgraded to mountain lion, then back to snow leopard, but at some point smtp had stopped working. I hope you can remove the bullet sales-people from the above commentary. : )
I had this issue at step 2 :
postfix: fatal: parameter inet_interfaces: no local interface found for 0.0.0.0
In main.cfg comment out the following line :
inet_interfaces = localhost
( or inet_interfaces = all )
Brilliant! Thanks a bunch.
And thanks to @Mark for the tip on rerunning -> “sudo postmap /etc/postfix/sasl_passwd” after saving the password file.
I have followed your instructions and this is working perfectly on my MacBookPro running Mavericks 10.9.2. I have a server, which is a MacMini which is running Mavericks Server 10.9.2. I copied the files from my MacBookPro to the server, put them in the proper places /etc/postfix, checked their permissions, did the postmap, then reload. Sent a trial email, but I never arrives to my account. Is there a log where I could find if there is an error? Both my laptop and server on on the same local network with both having access to the outside world.
I am seeing in the log:
Apr 19 13:05:25 jwooten37830.com postfix/cleanup[35785]: 227A83C18257: message-id=
Apr 19 13:05:25 jwooten37830.com postfix/qmgr[32382]: 227A83C18257: from=, size=294, nrcpt=1 (queue active)
Apr 19 13:05:25 jwooten37830.com postfix/smtp[35787]: connect to smtp.gmail.com[2607:f8b0:400d:c00::6c]:587: No route to host
Apr 19 13:05:26 jwooten37830.com postfix/smtp[35787]: 227A83C18257: to=, relay=smtp.gmail.com[173.194.68.108]:587, delay=1.7, delays=0/0/0.71/0.99, dsn=2.0.0, status=sent (250 2.0.0 OK 1397927134 j7sm62555545qab.27 – gsmtp)
Apr 19 13:05:26 jwooten37830.com postfix/qmgr[32382]: 227A83C18257: removed
No route to host?
This worked brilliantly ! Thanks
I worried when I was using 2 factor auth on Hotmail, however you can generate one time password.
Some of the information in Step 3 already exists in the config file
Thanks again 😀
Did the Yosemite upgrade break anyone else’s configuration? I’ve not changed my email or password…
Since the upgrade I’m getting:
Oct 22 13:35:38 DrozBook.local postfix/smtp[2466]: BA6451148F62: SASL authentication failed; cannot authenticate to server smtp.gmail.com[74.125.192.108]: generic failure
Oct 22 13:35:39 DrozBook.local postfix/smtp[2466]: BA6451148F62: to=, relay=smtp.gmail.com[74.125.192.109]:587, delay=6914, delays=6913/0.07/0.96/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server smtp.gmail.com[74.125.192.109]: generic failure)
Perhaps it’s the new version of postfix?
DrozBook:postfix tgagne$ sudo postfix reload
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: use_sacl_cache=yes
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: imap_submit_cred_file=
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: mydomain_fallback=localhost
postfix/postfix-script: refreshing the Postfix mail system
Oct 22 21:37:19 DrozBook.local postfix/postfix-script[3834]: refreshing the Postfix mail system
Oct 22 21:37:19 DrozBook.local postfix/master[3815]: reload — version 2.11.0, configuration /etc/postfix
I found the fix here:
http://stackoverflow.com/questions/26447316/mac-os-x-10-10-yosemite-postfix-sasl-authentication-failed
I needed to add the following line to main.cf and recycle postfix.
smtp_sasl_mechanism_filter = plain
Thanks! This fixed it for me on OS X 10.11.3
It looks like I’m receiving two errors.
Oct 28 13:51:46 Zaks-Accreon-MacBook-Pro.local postfix/smtp[3679]: 24AAB2B91B1: SASL authentication failed; cannot authenticate to server smtp.gmail.com[74.125.22.108]: generic failure
Oct 28 13:51:46 Zaks-Accreon-MacBook-Pro.local postfix/smtp[3680]: connect to smtp.gmail.com[2607:f8b0:400d:c04::6d]:587: No route to host
One saying I can’t authenticate and the other saying “No route to host.” I checked my username and password and they are correct.
Thoughts?
I configured /etc/postfix/main.cf
I get the error message:
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: mydomain_fallback=localhost
I work with OS X Yosemite.
What do I have to change?
Could you bring a Mac OS X Yosemite version of your document?
For me (Yosemite) I had to do two extra stuff
Add smtp_sasl_mechanism_filter=plain to main.cf
and change google security settings (Allow less secure apps: ON)
On El Capitan I had to use the following to update the plist. When I tired to edit it I couldn’t save. I couldn’t even delete it and replace it.
sudo launchctl unload /System/Library/LaunchDaemons/org.postfix.master.plist
sudo defaults write /Library/Preferences/org.postfix.master.plist RunAtLoad -bool YES
sudo launchctl load /System/Library/LaunchDaemons/org.postfix.master.plist
Thanks Benjamin! 🙂
Anyone actually using OS X Server with Mail enabled should be aware the location of postfix is /Library/Server/Mail/Config/postfix not /etc/postfix.
Thank you for the valuable info. I was only able to make it work on macOS Sierra with a smaller configuration and a few tweaks. Hope it helps others!
cd /etc/postfix
sudo vi sals_passwd
# Contents of sasl_passwd
#
[smtp.gmail.com]:587 [email protected]:YOURPASSWORD
sudo postmap /etc/postfix/sasl_passwd
sudo chgrp postfix sasl_passwd*
sudo chmod 0640 sasl_passwd*
sudo postmap -q [smtp.gmail.com]:587 sasl_passwd
(Check it was okay: should output your YOUSERNAME and YOURPASSWORD entry from sail_passwd file)
sudo vi mail.cf
# Lines added to the the end of of mail.cf
#
# Added to allow sending emails via GMAIL. You check also: http://old.thecabal.org/devin/postfix/smtp-auth.txt
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
smtp_tls_security_level = encrypt
sudo postfix -vvv reload
(Optionally you can redirect via the aliases file all your local email to your GMAIL account)
sudo vi /etc/aliases
# Added by YOUR_MAC_LOGIN_NAME
YOUR_MAC_LOGIN_NAME: YOUR_MAC_LOGIN_NAME,[email protected]
Great. Works exactly as described on OSX 10.9.5.
Thanks,
Mark
Hello Benjamin,
I have a issue after step 3 :
postfix: warning: /etc/postfix/main.cf, line 699: overriding earlier entry: relayhost=smtp.gmail.com:587
postfix: warning: /etc/postfix/main.cf, line 702: overriding earlier entry: relayhost=smtp.mail.yahoo.com:465
postfix: fatal: config variable inet_interfaces: host not found: loopback-only#Gmail
So i can’t do testing send email on gmail or others messageries.
Have you idea for fix it? Thanks you so much.
In case facing below issue:
SASL authentication failed; cannot authenticate to server smtp.gmail.com[74.125.130.109]: generic failure
Then you need to do below two things.
1. Create a low level app and password (https://myaccount.google.com/apppasswords), because the above config will not work with accounts having 2FA, and replace your password in /etc/postfix/sasl_passwd with the password given by google for this app.
2. in /etc/postfix/main.cf
add below line
smtp_sasl_mechanism_filter = plain
These change would remove above error.
Hello,
I have a security camera that stopped working due to email changes for security and no updated firmware for the camera. I have postfix working with a gmail from command line.
How or what do I need to do so my IP camera can send an email that will be relayed by postfix? Do I need to set the alias up? What user from the IP camera do I send to? Is there a default user I can send to from the camera? I’m running the latest Sierra Mac OS 10.12.5.
Thanks for any help you can provide
I was having problems with your instructions. The following solved the authentication issues I was having. Please update your article accordingly.
https://stackoverflow.com/a/9841770
smtp_sasl_mechanism_filter = plain
smtp_sasl_security_options = noanonymous
On step 5, the terminal process runs indefinitely and doesnt throw an error. Any suggestions?
Thanks
I tried this but all I get is postdrop: warning: unable to look up public/pickup: No such file or directory
I needed to skipp the stuff about sasl as I will not be using gmail smtp as I am using the one provided by my ISP, which does not require me to login or send out a user/password pair.
I get this error when testing out mail: postdrop: warning: unable to look up public/pickup: No such file or directory
Works great. I got it to work with High Sierra by:
1. running:
cd /etc/postfix/
sudo cp main.cf~orig main.cf
2. adding the minimum commands to the end main.cf described in step 3 PLUS
3. adding smtp_sasl_mechanism_filter = plain to main.cf
4. following the other steps
3. running the commands described by Pat Pawlowski | April 15th, 2016
Very nice.
Thanks Ben, confirmed this works on Sierra, cheers.
Здравствуйте.
Предлагаю раскрутить ваш сайт – недорого.
Честное продвижение вашего сайта по разумной стоимости.
Работаю комплексно. Не продаю по отдельности услуги (теги и т. д. ), которые в SEO обязательны.
Работаю до появления SEO-эффекта. Единственный результат seo-оптимизации сайта – его позиции в выдаче.
Работаю без несбыточных обещаний. Если сайт сделан на коленке, заниматься SEO бессмысленно. А вывести страницу сайта в ТОП -10 за месяц (особенно в конкурентном сегменте) невозможно. Реальный срок -от 45 дней.
Создаю устойчивый эффект SEO-оптимизации.
Работаю по адекватным ценам. Хорошее SEO само по себе не может быть дешевым.
Если письмо попало к вам по ошибке или вы не нуждаетесь в данных услугах – приношу свои извинения.
Boris https://ya.ru
Efforts happen when the respective spray enterprise falls below a owner caution’s pressure, making the suffering minimum. amoxicillin without rx buy BONUS PILLS buy amoxicillin without prescription Cheap amoxicillin Online no prescription How To Find Low Price amoxicillin Hassle Free? Which are the safest ways to get Mexico best price amoxicillin On The Web? Us Suppliers, Next Day.
I followed your instructions on configuring postfix to send mail from Mac OS X Mountain Lion. I have High Sierra on my mac. Nevertheless, I am getting the following error. connect to smtp.gmail.com[2607:f8b0:400d:c00::6d]:587: No route to host. I am using my regular mail address ‘[email protected]’. I am not receiving any email. When I run the test. Do you know why?
see this here https://kings-chance-play.com