How do you configure a Drupal linux dev system for sending email? My current dev system is a multi-site dual-boot windows/linux box with Apache 2.4/PHP 5.4.

In windows mode with a fresh install of D6 or D7, a verification email is properly sent when registering a new user. No contributed modules are required.

In linux mode (Ubuntu 12.04 LTS) the email does not work. I have tried using the ubuntu default (sendmail dummy?), sendmail, ssmtp, and postfix email packages with assorted configuration settings.

Most of the email packages seemed to have work from the command line.

With default or sendmail, a Create new account request causes the "wait" mouse-pointer to appear and remain like that for 30 secs or longer. The "email has been sent" message eventually appears but no email is ever received. With the postfix or ssmtp package installed, the same message appears within a second or two but no email is received.

I have searched for an answer on how to configure a Drupal linux system for email without much success.

The D6/D7 SMPT Authentication Support module solves this problem but it is a dependency that should not be necessary.

I don't have these problems running in Windows mode; never have in 3 years. I now have a shared NTFS partition so both modes use exactly the same code base.
Here is another attempt to answer the now questionable question...



Drupal core uses the php mail() function by default. See /modules/system/system.mail.inc

Context

Do you have a Linux based Drupal dev system? Does a fresh install of Drupal (6,7 or 8) appear to work? If an anonymous user attempts to create a new account, does it appear that an email is sent but NEVER received? Yes to all of the above?

A brief history. It was in the Fall of 2010 that I downloaded and installed this thing called Drupal (version 6). After creating a new account the system sent an email with a keyed link to set the new member password. I was impressed.

I was using a Windows XP laptop at the time.  Mail systems are not my speciality but I had managed to get websites to send emails. The sum total of my expertise at the time was this -- I was using some kind of SMTP thingy.

In the Spring of 2013 I switched to Ubuntu 12 for Drupal development. I recently discovered that the linux configuration did not send a new user email. The Win system (Windows 7) works like it always has since the XP days - it just works.

Most of us use email systems managed by our ISP, employer, or internet offerings such as Hotmail or Goggle's gmail.

I have since discovered I configured an smtp relay. A Drupal call to mail() will relay the message (with authentication if necessary) to my preferred mail server.

Windows install

On a windows (WAMP) system, there is a "window only" section in the php.ini file that allows the setting of a mail server. 

Linux install

A search for 'mail' using the Synaptic package manager revealed that the default lsb-invalid-mta package was installed (Linux Standard Base sendmail dummy). 

Linux has many mail systems available, sendmail, ssmtp, postfix, qmail  exim or nullmailer, to name a few.  They can get complicated. Most everybody with any experience prefers something other than sendmail.

Postfix

The postfix package seems to be the most popular. The trick here is to configure postfix as an SMTP relay. This means a call to mail() will relay the request to the mail server of your choice. 

Here is a suggestion on how to configure your Drupal development system using postfix as an SMTP relay:

Step 1 - Prepare system

Uninstall and remove each mail package that you have tried but have failed to get working:

sudo apt-get remove --purge [mail package that did not work]


Rinse and repeat as necessary. I have read somewhere that this is a good idea. If all goes well, sendmail for dummies (lsb-invalid-mta) will be left.

Step 2 - Install postfix (again if necessary)

sudo apt-get update
sudo apt-get install postfix


Step 3 - Configure postfix

Cut and paste the following code into your editor. Replace every occurrence of mailserver:port with something that works. Modify username and password accordingly.

Note the 'myorigin' setting does not include a port number.

You may then cut and paste these commands onto the command line. It is recommended that it be done in steps, one line at a time, just to see how things go.

# Open up a sudo session so you don't have to preface every
# command with 'sudo' - remember to exit when done!
sudo -s


The following commands work as s when logged in as 'root':

# postconf is a program that can modify the postfix config file /etc/postfix/main.cf
postconf -e 'relayhost = mailserver:587'
postconf -e 'myorigin = mailserver'

postconf -e 'smtp_sasl_auth_enable = yes'
postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd'
postconf -e 'smtp_sasl_security_options ='

# Authentication -- Substitute mailserver, username and password here:
echo "mailserver:587   username:password" &gt; /etc/postfix/sasl_passwd 

# Protect this password file
chown root:root /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd

# update the sasl_password.db file using the new password file
postmap /etc/postfix/sasl_passwd

# Restart
service postfix restart

# and exit the sudo session
exit


Step 4 - Test

If everything goes well, a variation of this command:

mail name@whatever.com


should work. You should be prompted for a Subject. After entering the subject line, follow with the body of the text (i.e. "Hello world!"). There is no prompt for "Body". I am not sure why.

Use Ctrl-D to complete the command.

Now check the email address for the message.

Acknowledgements

Maybe I should acknowledge Google because I used it to find these links, but the search was exhausting. Here are some of the pages I bookmarked. Some of them are quite old.

http://developernote.com/2012/07/how-i-configured-sendmail-for-php-on-ubuntu-server-12-04/#comment-27377

http://www.howtoforge.com/postfix_relaying_through_another_mailserver

http://www.howtoforge.com/how-to-relay-email-on-a-postfix-server

http://lenss.nl/2009/01/making-php-mail-work-on-ubuntu-through-postfix/