From ArchWiki
Revision as of 11:26, 21 December 2009 by Kitty (talk | contribs) (clean up)
Jump to navigation Jump to search

This article will show how to setup fdm to retrieve mail from various servers and deliver the mail to a user's mailbox in the home directory.

fdm Installation

Install Template:Package Official package with pacman:

# pacman -S fdm

Setup the home directory (mbox):

Alpine uses the mbox format, so we need to set up some files that we will be editing.

$ cd
$ mkdir mail
$ touch mail/INBOX .fdm.conf 
$ chmod 600 .fdm.conf mail/INBOX

Setup the home directory (maldir):

Mutt prefers a capitized mail directory, and is able to use the maildir format. If you plan on using Mutt do the following setup.

$ cd
$ touch .fdm.conf; chmod 600 .fdm.conf
$ mkdir -p Mail/INBOX/{new,cur,tmp}

fdm configuration

Edit .fdm.conf, and add your email accounts and basic filter rules. Use mbox or maildir, but not both.

## .fdm.conf
## Accounts and rules for:
#> foo@example.com
#> bar@gmail.com
## Last edit 21-Dec-09

# Catch-all action (mbox):
action "inbox" mbox "%h/mail/INBOX"
# Catch-all action (maildir):
# action "inbox" maildir "%h/Mail/INBOX"

account "foo" imaps server "imap.example.com"
	user "foo@example.com" pass "supersecret"

account "bar" imaps server "imap.gmail.com"
        user "bar@gmail.com" pass "evenmoresecret"

# Match all mail and deliver using the 'inbox' action.
match all action "inbox"

This will collect the mail from the listed accounts and deliver it to the INBOX folder that we made. Refer to the fdm(1) man page for specifics on how to connect to other types of mail servers (POP3 for example).

Additional Filtering

If you want to have mail from a certain account go to a specific mailbox, you could add the following lines to your fdm.conf file. From the config file above, if you wanted to filter the mail from bar@gmail.com into it's own folder bar-mail, you would add this below the existing "action" line:

action "bar-deliver" mbox "%h/mail/bar-mail"

Change the mbox to maildir if needed, also make sure the path is correct.

To activate the new action, add this before the existing "match" line:

match account "bar" action "bar-deliver"

Then all mail to bar@gmail.com will be put into the bar-mail mail folder.


Once you have this setup to your satisfaction, attempt to collect your mail by manually running fdm.

$ fdm -kv fetch

This will keep your mail untouched on the server incase there are errors. Look over the output to make sure everyting worked as planned. Open your favorite mail reader (MUA) and make sure that you can read the mail that was just delivered.

Mail check with cron

If all went well, set up a cron job to check your mail regularly.

$ crontab -e
*/15 * * * * fdm fetch >> $HOME/[Mm]ail/fdm.log