User:Paul/sandbox/Transactional mail server

WARNING: This article is in a user sandbox, indicating it is a rough draft, and as such, is likely incomplete, contains buggy and insecure configurations, and is subject to substantial and frequent changes.

A transactional email is generated by many popular packages, typically for account registration confirmation, topic reply notifications, password retrieval, and other automated uses. The emails will commonly be sent from an email address that is a non-functioning email account used exclusively for sending, such as NO-REPLY@example.com.

The PHP function is typically the default method that PHP packages will use for sending transactional mail. This function will use the server's default MTA to send the mail, thus necessitating an MTA to be installed. An MTA can be used to send mail directly from the server or can be configured to send mail through a smart host, typically to reduce server and admin overhead.

Most of the popular PHP packages will include an option or have a plugin available to send transactional email through an SMTP server, eliminating the requirement to install any type of MTA.

Transactional email via MTA
Setting up an MTA for transactional email is actually very simple.

username@servername:~$ sudo aptitude install postfix username@servername:~$ sudo ufw allow Postfix username@servername:~$ sudo ufw allow 'Postfix (v6)'

This is the very basics to have the server send transactional emails. The default configuration of Postfix is reasonably secure, but note that Postfix is not configured to support secure connections to other mail servers. Although, at best, securing communications between mail servers is an option that is up to each server's administrator, it is good to configure Postfix to allow

username@servername:~$ sudo ufw allow 'Postfix SMTPS' username@servername:~$ sudo ufw allow 'Postfix SMTPS (v6)'

SMTP mail server
This simple solution is most useful when delivering mail in small batches, but can create issues with large quantities of mail being sent at one time. When using this option it is best to choose a service that is intended to be used for sending transactional email. Most free email services (Gmail, Yahoo!, Hotmail, etc.) are not friendly to this type of usage and will often suspend accounts being used in this fashion. A better option is to use a service such as Mandrill or Mailgun. Mandrill offers up to 12,000 free emails per month while Mailgun offers 10,000 free emails per month, except for Rackspace customers, who get 50,000 free emails per month.