Chances are that you don't want to turn your personal laptop into a full blown mailserver, however it is very important to set up a local only mailserver in linux. This allows you to receive errors from failed cronjobs along with other processes, and also is handy for development purposes.
On Ubuntu simply enter
sudo apt-get install sendmail sudo sendmailconfig
and answer yes to everything in the config.
Now you may see errors in syslog (and mail.err, mail.log) like
"My unqualified host name (yourhostname) unknown; sleeping for retry".
This is basically because your hostname, "yourhostname", is
not a fully qualified domain name (FQDN) (e.g firstname.lastname@example.org). The solution is to edit
/etc/hosts, to something like
127.0.0.1 localhost.localdomain localhost 127.0.1.1 yourhostname.localdomain yourhostname
This fixed the error for me anyhow. Check it with
Now sendmail should be working.Trying
sendmail -t lee from terminal. Type your message, press enter then finish with ".", finally press enter again. You should see mail in
Note: you could at this point try sending my to a remote host, e.g. "email@example.com", but if your on a laptop (not a VPS), chances are your ISP will block it. When I tried
sendmail -vt firstname.lastname@example.org < mail.txt, I got the error
... Deferred: Name server: gmail.com.: host name lookup failure
although if I connected to my VPN and tried exactly the same again, things worked.
You can confirm that they're blocking the DNS MX record lookup by doing
dig gmail.com MX; I got a time out when connected directly, but no problems when on the VPN. The mail will be sent to the gmail SPAM folder at any rate.
Next I want to set things up so that I can read mail in Thundberbird. Even though this is postfix, the same principles apply. Importantly, we want to be able to read mail to root as well, so we forward it to our user.
/var/mail is one thing, but it would be nice to be able to check these in Thunderbird. Even though this post is for postfix, the same principles apply.
First I update
postmaster: root root: lee
so any mail directed to root comes to my user 'lee'. This allows me to monitor both root mail and lee's mail under one account. After making the changes, enter
Create the file
/root/.forwardcontaining just the entry
lee@localhost(or whatever your user is called) so root's mail will come to you.
sudo adduser lee mailto add my user 'lee' to the mail group so Thunderbird can actually access the mail files.
Now in Thunderbird: "add other account", choose type "unix mailspool (movemail)" and enter your username and email address, e.g. "lee" and "email@example.com"
Go to your new account in account settings, select server settings and select the local directory as
Almost there! Configure the SMTP server: go to preferences>account settings then right to bottom in the left menu, click SMTP server and add a new one as follows:
Description: localhost servername: localhost port: 25 connection secuirty: none authentication: no authentication username localhost
In the account settings click on your newly created email address, "lee@localhost" and choose the newly created SMTP server from drop down.
You should now be able to send/receive mail to the inbox....try sending a mail to root@localhost, click Inbox and click "Get Mail"from the top-left. For some reason I always need to click "Get Mail" despite telling Thunderbird to check for new mail automatically every 5 minutes. I'm not quite sure why as Thunderbird auto polls all other emails correctly.Share on Twitter Share on Facebook Share on Google+ Share on StumbleUpon