[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Configuring exim (or rather fetchmail and procmail)



> > But I am not sure it is the right thing to do, why wouldnt you want to receive
> > mail directly?
> 
> Because I am going to want to use procmail soon, and it's easier
> to configure it to only work through fetchmail, and because if I
> try to fetch mail with POP3 and SMTP a collision sometimes occurs.

>From my experiences with procmail, fetchmail and exim:

I use fetchmail to retrieve mail from pop3 servers, then fetchmail passes
the message to exim (or that's what I believe).

Here follows my fetchmailrc, procmailrc, ip-up and ip-down scripts for
anyone who wishes to configure procmail and fetchmail:

~/.fetchmailrc:
------------------------
defaults
        interface "ppp0/196.2.0.0/255.255.0.0" #very nice for a ppp link.

poll pop3.mweb.co.za
        protocol POP3
        user username_here
        password password_here
        fetchall
------------------------
The user can then run fetchmail to retrieve mail.

A system wide /etc/fetchmailrc is also useful, so that mail is retrieved
periodically by the system, for all users:
------------------------
set daemon 300 #check mail every 5 minutes (300 seconds)

defaults
        interface "ppp0/196.2.0.0/255.255.0.0"

poll pop3.mweb.co.za
        protocol POP3
        #download mail from hugovdm account to user hugo
        user hugovdm is hugo
        password password_here
        fetchall

poll mail.fnmail.com
        protocol POP3
        user anneke is anneke
        password password_here
        fetchall

poll mail.fnmail.com
        protocol POP3
        user mayvdm is mayvdm
        password password_here
        fetchall
------------------------

/etc/ppp/ip-up.d/fetchmail-up
------------------------
#!/bin/sh

test -r /etc/fetchmailrc && \
        fetchmail --syslog --invisible --fetchmailrc /etc/fetchmailrc
------------------------

/etc/ppp/ip-down.d/fetchmail-down
------------------------
#!/bin/sh

test -x /usr/bin/fetchmail && \
        fetchmail -q
------------------------

I then created a .forward file for myself. I believe exim looks at the
.forward file to see what to do with mail, so whether using exim or
fetchmail makes no difference to the working of procmail. (Someone correct
me if I'm wrong.) 

~/.forward:
------------------------
| /usr/bin/procmail
------------------------

This just pipes all mail to procmail.

~/.procmailrc:
------------------------
PATH=/usr/local/bin:/usr/bin:/bin
MAILDIR=$HOME/mail
LOGFILE=$MAILDIR/procmail-logfile

:0:
* ^Resent-Sender.*debian-changes@lists.debian.org
Debian-Changes

:0:
* ^Resent-Sender.*debian-user@lists.debian.org
Debian-User
------------------------

This worked for me. I haven't used it lately though (I renamed
.forward to disable it).

Notes:

:0  - marks beginning of recipe,
:0: - tells procmail to use a lock file with same name as folder.
*   - pass expression to internal egrep
^   - start of a line
.   - any character
*   - any number >= 1 of .  (.* represents any number of any characters).
Debian-Changes - file matching mail in this folder.

If a mail message matches no recipies, it is filed in $DEFAULT, which is,
by default, $ORGMAIL, which is, by default, /var/spool/mail/$LOGNAME.

See man procmailrc for more info. (And man fetchmail (not man
fetchmailrc).)

HTH someone,
Hugo van der Merwe


Reply to: