procmail
[Top] [All Lists]

Re: Auto Replies using MIME

1997-06-24 20:11:00
Quoting Matthew G. Saroff (msaroff(_at_)pca(_dot_)net):
      How would one do multipart?  I'd like to send a message saying 
"this is the file that you requested" along with the file.

I wrote the last one in a hurry, so there are some typos. Also, 
disregard the 8bit stuff and use base64--my mind was on something
else. Try this (untested):


:0h    # you could make this :0hc if you want a copy of the incoming message
* ^Subject:[    ]send pdf
*!^FROM_DAEMON
*!^X-Loop: you(_at_)your(_dot_)site
| (formail -rt -I"From: you(_at_)your(_dot_)site"\
     -I"X-Loop: you(_at_)your(_dot_)site"\
     -I"MIME-Version: 1.0"\
     -I"Content-Type: multipart/mixed; boundary=\"fls3jekls3=_sd3\"";
   echo "--\"fls3jekls3=_sd3\"";
   cat canned-reply.txt;
   echo;
   echo "--\"fls3jekls3=_sd3\"";
   echo "Content-Type: application/pdf";
   echo "Content-Transfer-Encoding: base64";
   echo "Content-Disposition: attachment; filename=file.pdf";
   echo "Content-Description: the pdf file you asked for";
   mimencode -b file.pdf;
   echo "--\"fls3jekls3=_sd3\""--) | $SENDMAIL -t

Notes:
The boundary can be anything you want, but it _must not_ exist anywhere
in the message that you're sending, either in the comment or in the base64
version of the file.

This assumes that your reply is standard 7bit us-ascii; if it is not,
you'll have to handle the encoding for that.

This is a nice way to show all the headers, but I'd probably merge all
the echo's and cat's and mimencode's into one file and cat that to the
output. It will cut down on the number of processes.

For more info, check out http://www.internic.net/rfc/rfc2045.txt and
rfc2646.txt; these are the rfc's dealing with mime encoding. They
reference several other rfc's that might help also.

Mike Stone

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