Use Evolution to read local mailbox

How do you as a normal user, running a plain old Fedora Core desktop, read root's local mail? It's easier than you think.

Author: Kanwar Ranbir Sandhu
Date: April 14, 2005

When you install a Red Hat based GNU/Linux distribution, one of the packages installed by default is Sendmail. This is done so that system messages can be delivered to the root user. Some of the messages root receives includes messages like disk usage, remote login attempts, errors and so on aggregated by Logwatch. As alluded to here, Logwatch is a system log analyzer and reporter. Here's an excerpt from the Logwatch man page:

LogWatch is a customizable, pluggable log-monitoring system. It
will go through your logs for a given period of time and make a report
in the areas that you wish with the detail that you wish.
Easy to use - works right out of the package on almost all systems.

This is great: a program that can look through the logs YOU want, HOW you want, and then report the bits you're interested in. The keyword here is "report". In order to do so, Logwatch mails the report to the root user, which is why Sendmail is installed by default, even on a desktop configuration. As long as you don't turn off the Sendmail service or remove the package all together, Logwatch will do its daily run, and then send its report to root's local mailbox in /var/spool/mail/root. A normal user cannot read root's email, but you can configure your system to have any and all messages destined to root to be diverted to your local mailbox instead.

You'll have to complete a two stage process in order to receive root's email in your Evolution Inbox. Here's what you do:

Stage 1

  1. Assuming you're running X, start a GNOME Terminal. You can find this in the System Tools menu under Applications.
  2. Since you have to make changes to a system file, you'll have to login as the root user. Type "$ su -". Hit enter after typing the dash. You'll be prompted to enter root's password. Go ahead and type it in, then hit enter again. You'll know you're logged in as the root user by the change in the prompt from a "$" to a "#".
  3. At the moment Logwatch sends email to root's local mailbox. We want to divert it to our local mailbox. To do that, we have to edit the file /etc/aliases. You can use any editor you want. For example: ""# vi /etc/aliases"
  4. You'll now be looking at the file Sendmail uses to figure out which recepient to send email to for local users. You'll notice that a default /etc/aliases file is setup to send all mail to the root user. Scroll down to the bottom of the file. You should now see a line similar to the following on your screen:
    # Person who should get root's mail
    root:
    
    (The hash here represents the beginning of a comment in the file.)
  5. Using alias lines in the rest of the file as a guideline for format, type in your local user ID. For example, if your user ID is "parminder", you would enter the following:
    root: parminder
    
    What this will do is redirect all messages destined for root's mailbox to your local mailbox. In this example, messages will now be delivered to /var/spool/mail/parminder
  6. Save your changes and exit the editor.
  7. Sendmail has to be made aware of the changes made to /etc/aliases. There's a special command to do just that. In your GNOME Terminal, enter the following:
    # newaliases
    
    This will rebuild the aliases database.
  8. Type "exit:"
  9. Type "exit:" again to close the GNOME Terminal

Stage 2

Now that root's email is aliased to your local mailbox, you need to configure Evolution to read the messages.

  1. Start Evolution.
  2. Go to Tools -> Settings.
  3. Click Mail Accounts.
  4. Click Add.
  5. Click Forward.
  6. Type in a name in the "Full Name" field.
  7. For the Email Address field, type in your login ID followed by @localhost. For example:
    parminder@localhost
    
  8. Click Forward.
  9. Click on the drop down list box and select "Local delivery".
  10. If the "Path" field in the Configuration section isn't already filled in, you'll need to type in the location of your local mailbox. Using the login ID from above as an example, here's what would be entered:
    /var/spool/mail/parminder
    
  11. Click Forward.
  12. If you like, you can setup Evolution to automatically check this mail account.
  13. Click Forward.
  14. You're not going to be sending mail with this account, so you could just leave everything alone in the Sending Email window. However, I change the "Server Type" to Sendmail.
  15. Click Forward.
  16. Finally, enter a name for the mail account. The name "Local Messages" is a good choice.
  17. Click Forward.
  18. Click Apply.

You're done! You'll notice in the Mail Account window that the Protocol listed for your new mail account is "mbox". This indicates that Evolution will be managing your local mailbox. Now when your system sends messages to the root user, Sendmail will use the alias you defined in /etc/aliases to deliver the mail to your local mailbox. Your Logwatch reports should now be picked up by Evolution for you to review. You can of course use any mail application to do this, so try Stage 2 with another client, such as Thunderbird.

man pages

I hope that was helpful. If you want to learn more about some of the applications mentioned in this How To, read the following man pages:

  • logwatch
  • aliases
  • sendmail
  • newaliases

Thank you Kanwar!
This page was generously written and donated to the community by Kanwar Ranbir Sandhu.
* Content Last Updated 2005-04-14 by Kanwar Ranbir Sandhu
* Minor Grammer Last Updated 2008-02-24 by Dotan Cohen
* HTML Last Updated 2008-02-24 by Dotan Cohen


 


Use Evolution to read local mailbox Use Evolution to read local mailbox Use Evolution to read local mailbox
[email protected] [email protected] [email protected] [email protected] [email protected]

eXTReMe Tracker