Added on Jun 3rd, 2012 and marked as mail postfix server

In order to send e-mail from the websites, we need to install a mailserver. Since we only want to send e-mails, we can use a send-only mailserver.

apt-get install postfix

During the configuration select the configuration for Internet Site. The system’s mail name should be a valid FQDN (also located in /etc/mailname).

Open the Postfix configuration file

nano /etc/postfix/

and check if the fields myhostname and mydestination also have a correct FQDN. The hostname should be a single hostname, the destination can consist of multiple entries (some remote, others local).

If the Postfix configuration was changed, the service should be restarted:

service postfix restart

To test if you can send e-mails from the website you can use the following PHP-script:


$to      = "[email protected]";
$subject = "Mail test";
$message = "This is a test";
$headers = "From: [email protected]\r\n";

if (mail($to, $subject, $message, $header))
  echo "OK: Mail sent to " . $to;
  echo "ERROR: Could not send mail to " . $to;


Possible problems

550 Access denied - Invalid HELO name: Make sure the field myhostname in /etc/postfix/ contains a fully qualified domain name. Thus not just myserver.