[prev in list] [next in list] [prev in thread] [next in thread] 

List:       procmail
Subject:    Re: Extracting attachments to work with -- why is this failing?
From:       Gerald Livingston <debuser () sysmatrix ! net>
Date:       2002-12-30 20:14:46
[Download RAW message or body]

On Sun, 29 Dec 2002 15:58:44 -0600 (CST)
"Gerald V. Livingston II" <debuser@sysmatrix.net> wrote:

> I have the following in my .procmailrc that I pulled from the list
> archives. The messages I found in the archives suggest it SHOULD work.
> It doesn't, and I can't figure out why.
> 
> Any assistance appreciated.
> 
> G
> 
> SHELL=/bin/sh
> PATH=$PATH:/usr/local/bin:/usr/local/mh/bin:/usr/bin:/bin
> MAILDIR=$HOME/Maildir/
> LOGFILE=$HOME/Mail/fetchlog
> METAMAIL_TMPDIR=/home/username/metatemp
> export METAMAIL_TMPDIR
> 
> [snip recipes that work]
>
> #HVWC PICTURE TEST (save a copy)
> :0c:
> * ^To.*hvwc.pic@sysmatrix.net
> .HVWC.pic/
> 
> :0 bfw
> * ^To.*hvwc.pic@sysmatrix.net
> |metamail -r -y -w -q -x
> 
> In my ~/Mail/fetchlog I get this: (excuse the wrapping)
> 
> Warning: Cannot freopen /dev/tty to stdinFrom gvl2@sysmatrix.net  Sun
> Dec 29 15:16:08 2002
>  Subject: test 6
>   Folder: .inbox2/new/1041196568.8313_3.phorce1
> 
> and it drops through to my "fallthrough" folder.
> 
> But, the copy that drops through has been altered and the original
> message is now gone and a multipart/mixed attachment to a new message
> is sent through that is .2K in size (empty). So, metamail does appear
> to be operating on the file, but failing and eating it in the process.

RTFM (again!) and started playing with flags.

First, dropped the "f" flag from the metemail recipe because once the
pictures are extracted I don't WANT another copy in my mail folders.
When Metamail finishes with it, it's done.

Started looking at he metamail flags -- waitaminute! Why are we using
"-y" to "yank" the content from a malformed MIME message -- we shouldn't
HAVE a malformed MIME message (and if we do, I don't want it) -- hmmmm
but the"b" flag for procmail means it's only feeding the body, not the
headers<sigh> -- removed both of those.

Added "r" to procmail flags to ensure metamail gets a clean
(un-munged) copy of the message.

Changed the way I export he METAMAIL_TMPDIR variable (though it just
cleans up a line, not functionally different).

Below is the set of recipe's that's working (mostly) the way I want.
After the message comes through I have the original copy in my
.HVWC.pic. Sitting in /home/username/metatemp I have all image
attachments, a file called headtext with the headers only, and a file
with a random name containing the TEXT part of the message body. The
only thing I want to change somehow is that I get the text part of the
body to have a consistent filename so I can work with it. So long as I
use the "w" flag in procmail and add whatever script I use to mangle and
send the files I SHOULD be able to work with the random filename by
deleting all the other files then using whatever's left over.

My intention is to rename the image files using a date/time format, ftp
them to a specified web folder, then create a new mail message
containing links to the web images and the original message body text.

Relevant parts of .procmailrc here:

*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_**_*_*_*_*_*_*_*_*_*

SHELL=/bin/sh
PATH=$PATH:/usr/local/bin:/usr/local/mh/bin:/usr/bin:/bin
MAILDIR=$HOME/Maildir/
LOGFILE=$HOME/Mail/fetchlog
export METAMAIL_TMPDIR='/home/username/metatemp'

#Regenerate a clean 'From' header
:0fhw
|formail -I "From " -a "From "

[OTHER RECIPES SNIPPED]

#HVWC PICTURE TEST
:0c:
* ^To.*hvwc.pic@sysmatrix.net
.HVWC.pic/

:0hcw
|cat>/home/gvl2/metatemp/headtext

:0rw
* ^To.*hvwc.pic@sysmatrix.net
|metamail -r -w -q -x


#Final failure -- dump to IMAP inbox2 folder
:0:
.inbox2/
#END
*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_**_*_*_*_*_*_*_*_*_*

G

-- 
Configure your Email to send TEXT ONLY -- See the following page:
http://expita.com/nomime.html

gvl2 (Gerald)
AirBall the Rolling Basket Case (1969 Standard Beetle)
LifeSaver (1974 Bay Window Bus)
http://www.phorce1.com

_______________________________________________
procmail mailing list
procmail@lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic