A quick and easy test to make sure SMTP is working on a server is to send an email, without a desktop environment this can be done via the command line. This how to demonstrates how to do so on Ubuntu.
First, make sure you have mailutils installed, otherwise you will not be able to use the mail command.
sudo apt-get install mailutils
Once installed the basic syntax is:
mail -s “Subject” alias@domain.com < message.txt
Where the -s parameter signifies the subject and then you direct the contents of message.txt into the email.
However, usually when testing SMTP you don’t particularly want to have to create a file with the test message in. If this is the case you can always echo the message and pipe it through to the mail command, like so:
echo ‘This is a test email’ | mail -s “Subject” alias@domain.com
Yes, it is that simple.



Useful, very useful. Thanks srcnix.
Now add an attachment
I will write a post about it, would be useful for others.
Thanks for the comment Simon.