Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] Tip for your LAN email system
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message

Joined: 17 Mar 2003
Posts: 293
Location: Albuquerque, NM, US

PostPosted: Thu Dec 08, 2005 1:10 am    Post subject: [HOWTO] Tip for your LAN email system Reply with quote

This guide shows how to relay local system mail messages from other computers on your LAN to your local central email system, so it's easily accessible in one place. This is my first attempt at writing a guide like this. Plus it was a while a go when I actually configured my server this way. So there could be mistakes, things left out, or this makes no sense.

View a screen shot of kmail showing the messages I get.

First, follow the documentation for Email System For The Home Network. If you don't already have a LAN email system.

WARNING Only set this option if you are not using postfix to relay your mail, which is described in Email System For The Home Network. I use net-mail/getmail rather than fetchmail which does not need a MTA. Look below for example getmail configuration if you want to do it this way.

Edit /etc/postfix/ and set the option home_mailbox to:
home_mailbox = <MAILDIR HERE>/.system/

where <MAILDIR HERE> replace with your MAILDIRPATH value from /etc/courier-imap/imapd
Make sure the .system directory exists. The "/" at the end is required.

You most likely will want:
home_mailbox = .maildir/.system/

Mine looks like:
home_mailbox = Maildir/.system/

This tells all local messages to go into ~/.maildir/.system/ like cron output, etc.
If you have postfix configured to route your mail, then you want it going into the root directory of your <MAILDIRPATH> as described in the Email System For The Home Network documentation. Then you can use filters to direct the system mail to a subdirectory.

Edit /etc/mail/aliases and add:
root:               username

Then run newaliases [this updates the aliases.db file. I'm not sure if it's needed for postfix or only for sendmail. It doesn't hurt to run it just in case.] Where 'username' put the username of your main user account that your email client is configured with. You don't have to do this step, but I don't want to configure my client to check mail as the root user. This way all the mail going to root actually goes to my main account.

For each computer on the lan. Install mail-mta/ssmtp. Edit /etc/ssmtp/ssmtp.conf
Set mailhub to:

mailserver is the computer running postfix and courier.

Tips that you can do with this:
Install and configure app-admin/logrotate for each computer.
Using a local rsync mirror. Sync portage telling you what needs upgrading for each computer. Here's an example crontab:
40 06 * * * /usr/bin/emerge --sync --quiet --nospinner && /usr/bin/emerge -uDpv --nospinner world

This tells the machine to sync daily at 6:40 AM. You want the --nospinner option since the output will go straight to email.

Configuring getmail: Only do this if you are not going to use fetchmail
I have a ~/.getmail/getmailrc-gmail file that looks like this:
verbose = 0
read_all = false
delete = true
delivered_to = false
message_log = ~/.getmail/log-gmail

type = SimplePOP3SSLRetriever
server =
username = myusername
password = mypassword
timeout = 500

type = Maildir
path = ~/Maildir/.myusername-gmail/

My crontab for this user looks like:
*/5 *   *   *   * /usr/bin/nice /usr/bin/getmail --getmaildir=~/.getmail --rcfile=getmailrc --rcfile=getmailrc-gmail >/dev/null 2>&1

This checks mail every 5 minutes on 2 accounts. Notice the multiple --rcfile= entries for multiple accounts. The 2>&1 keeps the output from filling up in system emails.

Check the getmail documentation for more help.
Understanding is a three-edged sword: your side, their side, and the truth. --Kosh
Back to top
View user's profile Send private message

Joined: 31 Jan 2004
Posts: 3059
Location: Korea

PostPosted: Fri Dec 09, 2005 9:27 pm    Post subject: Reply with quote

Seems pretty simple. Might try it sometime.

Though I'd recommend changing
/usr/bin/emerge -uDpv --nospinner world


/usr/bin/emerge -uDNpv --nospinner world

The -N (--newuse) is a pretty useful option
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum