From owner-freebsd-questions Sun Oct 3 21:50:11 1999 Delivered-To: freebsd-questions@freebsd.org Received: from compass.OregonVOS.net (compass.oregonvos.net [159.121.170.2]) by hub.freebsd.org (Postfix) with ESMTP id 739B615066 for ; Sun, 3 Oct 1999 21:50:06 -0700 (PDT) (envelope-from th@huppi.com) Received: from sis.huppih.com (ppp8-ast.orednet.org [159.121.170.193]) by compass.OregonVOS.net (8.9.1/8.9.1) with ESMTP id VAA28907; Sun, 3 Oct 1999 21:47:38 -0700 (PDT) Received: from localhost (th@localhost) by sis.huppih.com (8.8.8/8.8.8) with ESMTP id WAA03030; Sun, 3 Oct 1999 22:02:54 -0700 (PDT) (envelope-from th@huppi.com) X-Authentication-Warning: sis.huppih.com: th owned process doing -bs Date: Sun, 3 Oct 1999 22:02:47 -0700 (PDT) From: Tom Huppi X-Sender: th@sis.huppih.com Reply-To: Tom Huppi To: "Dr. Brain" Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Merging mail from two souces In-Reply-To: <37F7931E.4A4C9F17@gorean.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG (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