procmail
[Top] [All Lists]

RE: Piping message to ripMIME, then to curl

2002-04-23 04:07:26
reformime can extract the mime section to stout, but not quite sure how that 
helps you...?  Reformime is part of the Courier mail distribution.

-----Original Message-----
From: Jeff Kowalczyk [mailto:jtk(_at_)adelphia(_dot_)net]
Sent: 23 April 2002 11:43
To: procmail(_at_)Lists(_dot_)RWTH-Aachen(_dot_)DE
Subject: Piping message to ripMIME, then to curl


Regarding my question last week about using procmail to forward a 20Kb
text attachment received daily at a specific email address
("foo(_at_)acme(_dot_)com"), to a specific URL on a separate, non-UNIX 
webserver: I
think ripMime and curl will do the trick, if I can just get the procmail
recipe to move the output through stdio in two steps. ripMime will be
installed in /usr/local/bin, I do control the webserver also, but there
is no POP-reading component available to me at this moment, so I just
want the automated equivalent of pasting the text attachement in a HTML
form field and submitting the form.

I'm unclear on stdio usage within procmail. Can anyone guide me on how
to configure a procmail entry to do this in two steps, preferably
without generating temporary files:

1) Pipe the message to ripMime on stdin, and the attachment output to
stdio for step2

2) Send the output of ripMime on stdin to curl on stdio using the -d and
-u options, as below:

Perhaps a perl or bash script to do the same thing in one step from
procmail's POV would be better, more access to piping? Any suggestions?
Thanks!

-----------------------------------------------------
To use ripMIME...
If you have an MIME encoded archive (say from sendmail's output) 
called recvmail001.mime and you wish to unpack it to a directory
(which already exists) called "/var/tmp/unpack", then use ripMIME
as follows...
        ripmime -i recvmail001.mime -d /var/tmp/unpack
-----------------------------------------------------
CURL POST
<form method="POST" action="junk.cgi">
 <input type=text name="birthyear">
 <input type=submit name=press value="OK">
</form>
And to use curl to post this form with the same data filled in as
before, we could do it like:

curl -d "birthyear=1905&press=OK" www.hotmail.com/when/junk.cgi

This kind of POST will use the Content-Type
application/x-www-form-urlencoded and is the most widely used POST kind.
-----------------------------------------------------
CURL AUTHENTICATION
To tell curl to use a user and password for basic text authentication:

curl -u name:password www.secrets.com
-----------------------------------------------------

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>