Re: Extract emails from a text file

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Leslie Williams
Date:  
To: Main PLUG discussion list
Subject: Re: Extract emails from a text file
der.hans wrote:

>
> mbox format :).
>
> I believe Cyrus doesn't support mbox format. It's a sad, sad state.
>
> You could copy the folder locally and have access to it as a local mbox
> folder.
>
> I presume that you'd like to have the messages get properly filtered via
> procmail. If that's true look at formail.
>
> The procmail manpage lists info on using the two together, as does the
> formail manpage.
>
> ciao,
>
> der.hans
>


Thanks, der.hans and Paul for recommending formail. Although it didn't
work quite as well as I'd hoped, it worked well enough.

It apparently takes the plain text file (which is just email messages,
including headers) and turns it into mbox format.

When I did formail -d -s procmail < mail.txt, the procmail log reported
that it was processing all the emails and sending them to the proper
folders, but they didn't show up. When I looked in the imapd.log, I saw
the following, with the first two lines repeated, with different
timestamps, for each email message:


Jul 24 22:39:42 pentium3 lmtpunix[29658]: accepted connection
Jul 24 22:39:42 pentium3 lmtpunix[29658]: lmtp connection preauth'd as
postman
Jul 24 22:41:05 pentium3 master[6979]: process 29658 exited, status 0

Definitely not what I'd normally see when cyrus is processing emails. I
googled, but didn't really find anything to explain what it meant.

By using formail -d -s < mail.txt >> unfiltered and copying "unfiltered"
to Thunderbird's Local Folders, I was able to see all my messages.
However, when I tried to drag one of the emails from the Local Folders
to a folder on the imap server, I got this pop-up:

Alert
The current command did not succeed. The mail server responded: Message
contains invalid header.

By the way, I had to use -s even when I wasn't calling procmail,
otherwise formail just came back with the usage message. If I left off
the -d, I just got one big message with the first message's subject and
sender. It seems that -d adds a From field at the top of each message,
which is what allows Thunderbird to read the file properly when I put it
in Local Folders, but it's probably what cyrus is choking on both when I
try to drag it within Thunderbird, and when I try to process it thru
procmail.

Oh well, at least I can read the messages. I can forward anything worth
saving to myself.

Thanks,
Leslie

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss