Posted on 19th February 2013
Almost two years have passed since my last blog post, so I thought something nice and techy would be good to get started with again.
I'm new to managing my own server, I've always left it to WHM and cPanel to look after everything. After signing up with Linode and getting a basic web server up and running (Apache, PHP, MySQL) on an Ubuntu, I hit a problem. I wasn't able to send email from PHP. I needed to install a mail server.
In the past I've heard all sorts of horror storied regarding mail servers and therefore avoided managing anything myself – I've always left it to Google Apps (even though your typical WHM / cPanel sever can handle it – it wasn't worth the hassle). Knowing email servers hard a bit reputation for newbies to learn, I had no idea where to start.
The Linode Library has numerous guides for getting a full incoming and outgoing mail server setup – but they seemed incredibly technical and covered absolutely everything. All I wanted to do was send from PHP. No incoming mail, no sophisticated logging, no SMTP logins from email clients.
After some 'Googling', Postfix seemed to be a popular choice to run on Ubuntu, so I chose that. Here's how to get it setup (I used my Linode – Ubuntu 12.10 32bit):
sudo apt-get install postfix
You can test that everything has installed correctly by sending a mail from the command line by entering the following commands (don't forget to replace the email addresses):
sendmail you@youremailaddress.com
FROM: something@yourfqdn.com
SUBJECT: Postfix mail server test
This is a test message to test my installation of Postfix.
You should now have an email on it's way to your inbox. If it arrives, you should be able to send email from PHP using the mail();
function.
Enjoyed reading this blog post? See all my blog articles »