Skip to content

Script to Configure Postfix for Gmail (or any other) SMTP on Mac OSX

Notifications You must be signed in to change notification settings

munkee/postfixconf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 

Repository files navigation

postfixconf - Configure Postfix for Gmail (or any other) SMTP on Mac OSX

OSX - send email from command line

This script will enable and configure command line email on OSX. It basically does what is described here.

Install/Run

$ sudo bash -c "$(curl -sSL https://raw.github.com/roubles/postfixconf/master/postfixconf.sh)"

Note: This must be done as sudo.

Sample output

$ sudo ./postfixconf.sh 
Type the SMTP hostname and port (example: smtp.gmail.com:587): smtp.gmail.com:587
Type the full username (example: [email protected]): [email protected]
[email protected]'s Password: 
Confirm [email protected]'s Password: 


Working...
That relay host smtp.gmail.com:587 is already in /etc/postfix/main.cf. Attempting to update.
That relay host is already in /etc/postfix/sasl_passwd. Attempting to update.
Configuring gmail smtp
Updating /etc/postfix/main.cf
Updating /etc/postfix/sasl_passwd
NOTE! For gmail you must enable less secure apps for postfix to work: https://www.google.com/settings/security/lesssecureapps
Restarting postfix
Sending test email to [email protected]
You are done. Check [email protected]'s email.
Do you want to tail /var/log/mail.log [y|n]:n 

Now what?

You should now be able to send emails as such:

$ echo "42" | mail -s "The answer to life the universe and everything" [email protected]

Trouble in paradise

If you are having issues, checkout /var/log/mail.log

$ tail -f /var/log/mail.log

You can see your outgoing mail queue as follows:

$ mailq

About

Script to Configure Postfix for Gmail (or any other) SMTP on Mac OSX

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%