How do I read local email in thunderbird? [duplicate]

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?


Solution 1:

(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 hereenter 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.

Solution 2:

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.

Solution 3:

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.)