mod_sendmail is an Apache module which gateways an incoming HTTP request to SMTP using your preferred SMTP server.

The module is designed to remove the need for machines needing to send email having to have an MTA installed on that machine. The module allows relay protection to be provided using the standard Apache httpd authentication mechanisms, including password based authentication and digital certificates.

This could be interesting in environments that require some sort of mail delivery but won’t allow SMTP submission via standard TCP ports.

    curl -X POST -d "Hello there" -H "Content-Type: text/plain" \
         -H "To:" -H "From:" \
         -H "Subject: test" http://localhost/sendmail

And it appears that the sendmail endpoint can be protected by the standard Apache authorization mechanisms, and it is possible to use fields from the authorization to set the sender of the e-mail. Even though my first thought upon reading about mod_sendmail was: “Haven’t we being doing this for years with CGI?”, I must test this.

Mail, CLI, HTTP, REST, and SMTP :: 09 Apr 2011 :: e-mail