Skip to content

Instantly share code, notes, and snippets.

@AhmedKammorah
Created July 31, 2013 01:50
Show Gist options
  • Save AhmedKammorah/6118682 to your computer and use it in GitHub Desktop.
Save AhmedKammorah/6118682 to your computer and use it in GitHub Desktop.
Edit php.ini
sendmail_path = /usr/sbin/sendmail -t -i
Turn on the mail server your hostconfig file:
Run sudo nano -w /etc/hostconfig in Terminal. Look for the line starting MAILSERVER=, if you don’t see it, add it and make sure it reads:
MAILSERVER=-YES-
Edit /etc/postfix/main.cf and add the following to the end:
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_use_tls = yes
smtp_enforce_tls = yes
smtp_sasl_security_options =
smtp_sasl_tls_security_options =
smtp_sasl_tls_verified_security_options =
smtp_tls_loglevel = 2 # optional if you wan to see what's going on with the TLS negotiation in /var/log/mail.log
smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_passwords
smtp_tls_per_site = hash:/etc/postfix/smtp_tls_sites
tls_random_source = dev:/dev/urandom
Create /etc/postfix/smtp_sasl_passwords with the following contents:
smtp.yourisp.com username:password
Create /etc/postfix/smtp_tls_sites with the following contents:
smtp.yourisp.com MUST_NOPEERMATCH
Then run the following commands:
$ cd /etc/postfix
$ chmod go-rx smtp_sasl_passwords
$ postmap smtp_sasl_passwords
$ postmap smtp_tls_sites
To test, try:
echo "Hello" | mail -s "Test" [email protected]
The above test may not work if your provider requires a valid source e-mail address. If that's the case, try:
printf "Subject: TestnHello" | sendmail -f [email protected] [email protected]
This second test form specifies the "from" address as you, but can be changed to anything you want as long as it passes muster with your provider's server. You can now check the logs:
tail /var/log/mail.log
Or, if you're crafty, you'll open a second Terminal window, and before running the tests in the first window, do:
tail -f /var/log/mail.log
sudo mkdir -p /Library/Server/Mail/Data/spool
sudo /usr/sbin/postfix set-permissions
sudo /usr/sbin/postfix start
hints.macworld.com/article.php?story=20081217161612647
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment