Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just install postfix and configure 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?

share|improve this question
add comment

3 Answers 3

up vote 15 down vote accepted

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

share|improve this answer
    
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. –  gsc-frank Oct 24 '12 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. –  otakun85 Jul 30 '13 at 12:09
1  
Fantastic answer, you nailed it. Wish I could upvote you more! –  eggonlegs Sep 2 '13 at 3:06
add comment

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

share|improve this answer
add comment

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.

share|improve this answer
1  
I can't found where specify "/var/spool/mail", beside, how can I email to that account to test it? –  gsc-frank Sep 25 '12 at 0:19
    
Can I uses another email client beside Thunderbird to read /var/mail/USERNAME emails? Take in consideration that I need HTML capable email client. –  gsc-frank Sep 25 '12 at 4:38
    
Works now, just must replace "@(none)" for "@localhost" in the initial configuration wizard. –  gsc-frank Sep 25 '12 at 5:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.