Reply to comment

Sending email from a local development machine using a Smart Host

Tagged:

Sending email from your local machine using Drupal or any other PHP based application often does not work. The solution is to use a remote mail server (called Smart Host) for delivering emails.

Most ISP's mail servers today are preventing mail relaying or fighting SPAM at the SMTP level. Consequently sending email from Drupal or other PHP applications using your local Apple or Linux machine probably never hits the addressee. This makes developing mail functionality somewhat inconveniently.

The solution is to configure your local MTA (mail transport agent) like Postfix to use a remote mail server (called Smart Host) for delivering emails.

At Mac OS X 10.5 the Postfix MTA is available and can be configured using a Smart Host with SSL based SMTP authentification. To follow this steps in your Terminal.app (or Shell) you need:

  • your.isps.mailserver: The SMTP server you want to use as Smart Host
  • username and password for the SMTP server
  • The SMTP server must speak SMTP over TLS/SSL

sudo postconf -e relayhost=your.isps.mailserver smtp_use_tls=yes smtp_sasl_auth_enable=yes smtp_sasl_password_maps=hash:/etc/postfix/smtp_auth tls_random_source=dev:/dev/urandom smtp_sasl_security_options=noanonymous
sudo sh -c 'echo "your.isps.mailserver username:password" >> /etc/postfix/smtp_auth'
sudo chown root:wheel /etc/postfix/smtp_auth
sudo chmod 600 /etc/postfix/smtp_auth
sudo postmap hash:/etc/postfix/smtp_auth

Send yourself a test email from the shell: echo "test" | mail -s "test" your@email
Check /var/log/mail.log for errors regarding the delivery to the smart host.

Mouse addicted users may consider using the MailServeForLeopard Mac application instead of doing the configuration described above.

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Insert Google Map macro.

More information about formatting options