I'm setting up a system calling fetchmail
from the commandline and specifying that the mail be stored in a specific file which is not /var/spool/mail/$USERNAME
.
How to specify the inbox for fetchmail
fetchmail
fetchmail
I'm setting up a system calling fetchmail
from the commandline and specifying that the mail be stored in a specific file which is not /var/spool/mail/$USERNAME
.
Best Answer
By default, fetchmail invokes the local mail transfer agent (MTA). That's the program you need to configure to set the location of users's mailbox. If you want to change the place where a specific user's mail is delivered, most MTAs read the file called
.forward
in your home directory. You can put a different path in your own~/.forward
file (just one line containing the full path of the mailbox file where you want your mail to be delivered).You can also write
|someprogram
in your~/.forward
file to invoke a mail delivery agent (MDA), i.e. a program that reads the mail and determines what to do with it based on custom rules. Two popular MDAs are procmail and maildrop.If you're only receiving mail through fetchmail, rather than go through the local MTA, you can tell fetchmail to invoke an MDA directly. Pass the
-m
option on the command line or use themda
setting in~/.fetchmailrc
. For example, one way to deliver mail directly to~/mail/incoming
is to putmda procmail
in~/.fetchmailrc
, and have a~/.procmailrc
consisting ofOr put
mda maildrop
in~/.fetchmailrc
and have a~/.mailfilter
consisting of(The resemblance between procmail and maildrop configuration files doesn't go much further.)