• Set the hostname
  • Set the reverse DNS
  • Ensure dnsutils ar installed
sudo aptitude install dnsutils

Check Reverse DNS

To check if RDNS propagated already:

dig -x

If "ANSWER SECTION" still shows the old name (or anything other than your server hostname) - you'll have to wait until propagation will finish before proceeding.

Install Postfix

sudo aptitude install postfix

During the installation you will be asked the general type of mail configuration. Choose the 'Internet Site' option.

You will then need to enter your main domain name. This should match the reverse DNS.


Edit the main Postfix configuration file:

sudo nano /etc/postfix/

You are looking to override the following variable values, replacing and

mydomain =
myorigin = $mydomain
myhostname =

Update the networks value:

Replace this: mynetworks = [::ffff:]/104 [::1]/128
with this: mynetworks =

Restart postfix to make changes take effect:

sudo /etc/init.d/postfix restart

SPF Records

The purpose of Sender Policy Framework (SPF) Text is to allow a mail server to validate that the sending mail server is authorized to send mail on behalf of a domain. Having an SPF record can reduce email fraud and forged email.

If your Linode is going to send out mail on behalf of your domain and it is not explicitly listed as the destination for your domain or the MX records then you are advised to add an SPF record to your DNS.

A good place to help you construct your SPF record is to use the wizard located on the official SPF home page -

Test Send

There are two methods described here for testing mail sending from your server. One uses the mail command the other telnet.

Mail Command Method

Install the mail command:

sudo aptitude install mailx

Send the test mail:


Replace the email address with one of your choosing (remember this must be a working email address).

The output asks for the subject of the email. Once done, press enter/return.

Next enter the body of the email. Once done, press enter/return and then a single period (.) - the period lets mail know the body is finished.

Finally press enter/return again to send the email (you may need to do this twice so you skip the 'CC:' entry.

The output on my machine looks something like this:

Subject: test email from my linode
test body of the email.

Telnet Method

Telnet is not installed by default, so to install it use the following command:

sudo aptitude install telnet

To open a telnet session into Postfix then issue:

telnet localhost 25

Connected to
Escape character is '^]'.
220 ESMTP Postfix

Where should appear as the FQDN of your server. Now identify the the server by typing the following:


This should yield a 250 response.

Now set the sending email address:


This should yield a 250 2.1.0 Ok or similar response.

Now set the email address of the recipient:


This should also yield a 250 2.1.0 Ok or similar response.

Now you can enter the body of the message. Type typing:


This will display the 354 End data with <CR><LF>.<CR><LF> response. Simply type a message, hit return and enter a full stop on a line of it's own then hit return again. This should send the email out.

You can either send another email by starting with the HELO instruction, or quit by typing:


Now check the mail account of the recipient to see it has arrived okay.


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License