I just install postfix and configured it for local email only as a way to have a sendmail program and test my PHP scripts.

My question is, how can I use an HTML capable email client like Thunderbird to read local (root email, etc.) emails?


3 Answers 3


(When I am discussing the setup below, I am using desktop Ubuntu 12.04)

Now that you have installed postfix (it can be reconfigured with sudo dpkg-reconfigure postfix) and now there is a file called main.cf in /etc/postfix, Thunderbird can be set up to read any system emails. However, I have found that it often takes a bit more time than has been suggested if you want to both receive from and send messages to root@localhost.

First, as recommended in this discussion what worked for me was to use postfix's aliases feature to allow mail to be redirected; edit the aliases file with sudo nano /etc/aliases so that it looks like this (replace my user name with your own):

postmaster:    root
root:   mike 

Then run sudo newaliases so that the configuration is updated.

As also noted in the above link, you need to create a .forward file containing your username and localhost: e.g. mike@localhost so that root's mail will be forwarded to you. To do this, enter these commands:

sudo touch /root/.forward

and then run

sudo nano /root/.forward

to place your user: e.g. mike@localhost in the file and save it.

In addition, I found it was necessary to add your user to the mail group so that Thunderbird could access the mail files:

sudo adduser $USER mail

and then logout and login for the changes to take effect. There is no need to chown or chmod any files, as some articles might suggest.

Now for the Thunderbird configuration. Go to edit > account settings > account actions > add other account > select Unix spoolmail and in the next screen put your username in the first box and place yourusername@localhost in the second box.

enter image description here enter image description here

Now, go to your new account in account settings and select server settings and select the local directory as /var/mail or /var/mail/username (if setup), as in the screenshot below.

enter image description here

As per the instructions in this article you will need to configure the smtp server if you want to test the account by sending a mail to root@localhost and then clicking get mail in Thunderbird to receive it, as root's mail is being redirected to youruser@localhost.

Go to account settings > outgoing server and choose to add a new one. The settings should be as in the screenshot below:

enter image description here

Now, finally test your account by composing a mail to root@localhost and then a few seconds later clicking get mail on your account. You should see an email like this:

enter image description here

Some programs or logs will need to be configured so that they send mail to root, but that can be decided as you find the need. This article should hopefully be useful as it is not always straightforward to set up Thunderbird to receive local mail.

  • 1
    Excellent! you are great! I just want add this link serverfault.com/questions/94640/… as reference to those who want have a complete local developer environment when doing PHP scripting and want test email feature.
    – user58366
    Oct 24, 2012 at 22:27
  • It would be nice to know, if it is possible to receive all send mails. Because in some environments user@localhost is no valid mail address and can therefore not be used.
    – keiki
    Jul 30, 2013 at 12:09
  • 1
    Fantastic answer, you nailed it. Wish I could upvote you more!
    – eggonlegs
    Sep 2, 2013 at 3:06
  • after creating the forward use this to create /var/mail/(user) and test sending mails: $ mail root\n test\n content\n. end mail composing and send with Ctrl-D or \n.\n¸. (replace \n with enter key, no multiline code allowed in comment)
    – JPT
    Jan 14, 2018 at 16:23
  • For me, I'd logged in using the user's account when I ran the thunderbird so I didn't need to set the server address to user's mail directory. Amazing answer, thanks!
    – aderchox
    Jun 1, 2020 at 19:59

Try Edit-> Account Settings and under Account Actions choose "Add Other Account."

Choose "Unix Mailspool (Movemail)" from the list and continue the configuration with your name, account, other settings.

When you "Get Mail" it should look in /var/spool/mail on your system (localhost) for your mail file.

  • 1
    I can't found where specify "/var/spool/mail", beside, how can I email to that account to test it?
    – user58366
    Sep 25, 2012 at 0:19
  • 1
    Can I uses another email client beside Thunderbird to read /var/mail/USERNAME emails? Take in consideration that I need HTML capable email client.
    – user58366
    Sep 25, 2012 at 4:38
  • 1
    Works now, just must replace "@(none)" for "@localhost" in the initial configuration wizard.
    – user58366
    Sep 25, 2012 at 5:10
  • Doesn't work anymore, Unix Mailspool option was removed from Thunderbird =( bugzilla.mozilla.org/show_bug.cgi?id=1625741
    – Madacol
    Feb 2, 2022 at 15:38
  • 1
    I've found a workaround, sudo apt install mailutils-pop3d, restart your system, and add a normal mail account user@localhost and your password, Done!. mailutils-imap4d probably works too instead (untested)
    – Madacol
    Feb 2, 2022 at 20:07

i find this so much easier:

after installing postfix, you just make a symlink to the local /var/mail/username file inside thunderbird folders.

in short:

Create a subfolder in "Local Folders/Inbox" called "System", or whatever. Exit Thunderbird, move into ~/.thunderbird/xxxx.default/Mail/Local\ Folders/ find the text file called System. Replace it with a symbolic link to /var/mail/username

cd /home/pepito/.mozilla-thunderbird/xxxx.default/Mail/Local\ Folders/
rm System
ln -s /var/mail/username System

(personally, i don't need smtp - so i didn't dig into it.)