Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Oct 1999 22:02:47 -0700 (PDT)
From:      Tom Huppi <th@huppi.com>
To:        "Dr. Brain" <drbrain@toxic.magnesium.net>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Merging mail from two souces
Message-ID:  <Pine.BSF.4.05.9910031539130.2227-100000@sis.huppih.com>
In-Reply-To: <37F7931E.4A4C9F17@gorean.org>

next in thread | previous in thread | raw e-mail | index | archive | help

(I think) I have fetchmail snatching mail from my POP3 mailbox at
my ISP then delivering it to procmail via the .forward file
mechanism.  Procmail then either puts each mail into my normal
mail spool /var/mail/th or into one of the mailbox files in my
~/mail/ directory as instructed by my ~/.procmailrc recipe.  
Whether using IMAP instead of POP3 would change things, I just
don't know.  Also I don't know if and/or where sendmail is
involved here.  I'd like to, but it doesn't matter too much.

At any rate, installing procmail, making a one-line .forward file,
and creating a simple .procmailrc (man procmailrc) is all that it
took.

Part II.  I had a mailbox file in ~/mail/ with 1000 mails in it
which I wanted filetered via my new .procmailrc. (Primarily to
sort out the mail to the various FreeBSD lists into individual
mailboxes if you must know :)  A line like this worked like a
charm:

   formail -s procmail < temp_mbox_file

Note that I have a ~/mail/ directory since that is what my mail
agent, pine, set up.  Also, you would want to be really carefull
that the file you feed into formail (the ftp'd mailbox in your
case) is not one which procmail delivers to or you would (I
conjecture) get an endless loop.  BTW, formail is a little program
that comes with procmail and can, with relative safety, do all
kinds of nifty things with mailbox files in case you are
wondering...I would have been if I had not been exposed to it
previously. (man formail)

Going on into uncharted territory (for me), it seems like one
could make a little script that would 1) induce fetchmail to do
it's thing, 2) ftp your mailbox file (and clean up the remote
site), and 3) run the ftp'd file through formail.  This would be
the "merge" that you asked about.

Do take my comments with a grain of salt since I am a newbie!
There are probably much more straighforward ways of doing what you
want.  For all I know, you might be able to simply cat the file
and your mail spool but I certainly wouldn't want to try it.  I
think I have just taken 5 times longer to say what Barry
said...I mainly wanted to mention what formail was.  You wouldn't
really need procmail, but once you have it going you may find it
handy for all kinds of stuff (man procmailex).

-Tom

---------for ref--------

On Sun, 3 Oct 1999, Doug wrote:

> Barry Irwin wrote:
> > 
> > On Sat 1999-10-02 (13:51), Dr. Brain wrote:
> > > I want to merge mail from two different sources, one is downloaded through
> > > fetmail via an IMAP server, and the other is an ftp download from a remote
> > > FreeBSD machine.  Is there any way I can merge these two together?  As I
> > > understand it, fetchmail grabs my mail and dumps it into /var/mail/hodeleri.
> > > If I wanted to ftp down the other mail, I would put it in /var/mail/hodeleri
> > > this seems to be a bit of a problem though.  RTFM is appreciated, just point
> > > me to the right place.
 
> > Not too sure about the fetchmail details, but as far as I am aware it uses
> > your local MTA to deliver the mail it retrieves.  For your FTP'd Mailbox, aa
> > solution would be to use formail.  This can then split your ftp'd mailbox up
> > into its constituant messages and pass them onto the appropriate MTA , which
> > will then deliver them

> 	Fetchmail can also be configured to use an mda of your choice, like
> procmail. That makes it very handy to merge mail from different sources.
> I consolidate mail from several different accounts automatically with a
> combo of fetchmail, procmail and a couple of scripts to handle extreme
> cases. In your .fetchmailrc file do something like this:
> 
> defaults
>         proto pop3
>         fetchall
>         mda "/usr/local/bin/procmail -f-"
> 
> and you'll be home free.
> 
> Good luck,
> 
> Doug
> -- 
> "Stop it, I'm gettin' misty." 
> 
>     - Mel Gibson as Porter, "Payback"
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
> 



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9910031539130.2227-100000>