PDA

View Full Version : [HOWTO] Forward root's mail to your inbox



HungSquirrel
December 6th, 2004, 10:57 AM
Occasionally, certain system daemons and utilities will send local Unix mail to root's local email inbox, /var/mail/root . Well, it doesn't do you much good there!

If you want to read these system messages, you can always do sudo mutt -f /var/mail/root if you are familiar with mutt. However, an easier and more efficient way to check this mail would be to have it forwarded to your user's local inbox, and then read it with your favorite email reader.

Throughout this HOWTO, replace username with your account name.

First, you need a mailbox, preferably with all of root's old mail already in it.


cd /var/mail
sudo cp root username
sudo chown username username
sudo chgrp username mail

That creates a mailbox for your username with the appropriate user and group permissions. The contents of the mailbox are a copy of root's mailbox.

Now, it's time to forward all of root's incoming mail to your inbox.


sudo gedit /root/.forward

Put this line in the file:

username@localhost

Now, you will receive any mail sent to root. To make things more convenient, let's set up Evolution to read the mail.

(Note: I use Thunderbird as my email client, and it required me to change the permissions of the /var/mail directory. I don't know if Evolution also requires this. If you get some sort of permission errors, you may need to sudo chmod 777 /var/mail , which is what Thunderbird wanted me to do.)

Open up Evolution. In Tools -> Settings -> Mail Accounts, click Add. Enter your Full Name if you wish, and your local mail address username@localhost, then click Forward.

For server type, select "Standard Unix mbox spool or directory." For Path, enter /var/mail/username , then click Forward.

The options on the next screen are optional. Moving right along!

On the next screen, select Sendmail for the Server Type, then click Forward. Name the account however you wish. I would recommend username@localhost, Local Mail, or something similar. Now you're finished!

To test, compose a mail to root@localhost and send it. Then click Send/Receive. You should see the new mail (http://hungsquirrel.org/images/rootmail.jpg) pop up in your inbox.


I am quite new to this, so if there are any errors in here, please feel free to tell me so I can edit this post for accuracy!

Cuber
May 11th, 2005, 05:51 PM
Occasionally, certain system daemons and utilities will send local Unix mail to root's local email inbox, /var/mail/root . Well, it doesn't do you much good there!

If you want to read these system messages, you can always do sudo mutt -f /var/mail/root if you are familiar with mutt. However, an easier and more efficient way to check this mail would be to have it forwarded to your user's local inbox, and then read it with your favorite email reader.

Throughout this HOWTO, replace username with your account name.

First, you need a mailbox, preferably with all of root's old mail already in it.


cd /var/mail
sudo cp root username
sudo chown username username
sudo chgrp username mail

That creates a mailbox for your username with the appropriate user and group permissions. The contents of the mailbox are a copy of root's mailbox.

Now, it's time to forward all of root's incoming mail to your inbox.


sudo gedit /root/.forward

Put this line in the file:

username@localhost

Now, you will receive any mail sent to root. To make things more convenient, let's set up Evolution to read the mail.

(Note: I use Thunderbird as my email client, and it required me to change the permissions of the /var/mail directory. I don't know if Evolution also requires this. If you get some sort of permission errors, you may need to sudo chmod 777 /var/mail , which is what Thunderbird wanted me to do.)

Open up Evolution. In Tools -> Settings -> Mail Accounts, click Add. Enter your Full Name if you wish, and your local mail address username@localhost, then click Forward.

For server type, select "Standard Unix mbox spool or directory." For Path, enter /var/mail/username , then click Forward.

The options on the next screen are optional. Moving right along!

On the next screen, select Sendmail for the Server Type, then click Forward. Name the account however you wish. I would recommend username@localhost, Local Mail, or something similar. Now you're finished!

To test, compose a mail to root@localhost and send it. Then click Send/Receive. You should see the new mail (http://hungsquirrel.org/images/rootmail.jpg) pop up in your inbox.


I am quite new to this, so if there are any errors in here, please feel free to tell me so I can edit this post for accuracy!
Can you explain how you have setup thunderbird to get this mail?

I do not wanna use two different mail clients :-D

gloups
June 5th, 2005, 09:20 AM
see here:
http://ubuntuforums.org/archive/index.php/t-10019.html

TheWizzard
June 15th, 2006, 11:31 AM
hi
i found this howto very useful. however, i want to forward the root mail to an external mail account (gmail). postfix seems to block this.
has anyone any clue how to let postfix send mail to an external account?
cheers

jetpeach
June 17th, 2006, 10:42 PM
thewizzart - i am also interesting in forwarding it to an external account. since this thread is in warty i'll start a new thread in dapper. if i can find an answer, i'll post a howto in the howtos section. also, please let me know if you've found a solution.

carlos22
June 18th, 2007, 01:57 AM
Thanks a lot .. very clar and very simple.

TheWizzard
June 18th, 2007, 10:53 PM
thewizzart - i am also interesting in forwarding it to an external account. since this thread is in warty i'll start a new thread in dapper. if i can find an answer, i'll post a howto in the howtos section. also, please let me know if you've found a solution.

sorry i didn't reply to this earlier.
i found something:
- forward roots mail to gmail directly doesn't work
- forward roots mail to personal account and then forward to gmail works.

Robb987
June 7th, 2008, 12:44 PM
This post is a while ago, but I tried to get it to work in Ubuntu 8.04 and Evolution.

I found out there is no root emailbox in /var/mail on my pc, but I found my username emailbox filled with e-mail from root@localhost.

So no need to chmod anything nor forward e-mail, it's my own mailbox ;-)

I configured evolution as told in the first post. It did not work. But I needed to change only one thing:

"For server type, select "Standard Unix mbox spool or directory.""
to:
For server type, select "local delivery."

That's all!

By the way, thanks for this nice howto!

MechaMechanism
May 3rd, 2009, 09:36 PM
Would this not be more simple if you used Exim4.


sudo aptitude install exim4There is no further set up required and the root mail is automatically delivered to the first user account. Also for Thunderbird it's real easy.


sudo adduser USERNAME mailThis will very nicely set up the proper permissions for Thunderbird. Chown 777 is too ugly.

duceduc
March 13th, 2012, 01:34 AM
I know it's an old thread, but I couldn't find my answer. How do I setup with thunderbird?

von Stalhein
March 13th, 2012, 12:05 PM
I know it's an old thread, but I couldn't find my answer. How do I setup with thunderbird?

Nice Lazarus job :D

I'm keen to know as well - I tried here http://bit.ly/bNNOa but failed at he first hurdle as there is no etc/aliases to modify on my system.

I have created one, so I'll stuff around with it from there.