procmail
[Top] [All Lists]

Re: recipe for (Re: Return an attachement...)

1998-11-12 14:44:53
On 12 November 1998, Doug Monroe <monroe(_at_)lucent(_dot_)com> wrote:
Liviu Daia wrote:

On 11 November 1998, Doug Monroe <monroe(_at_)lucent(_dot_)com> wrote:
...apologies if below [untested] recipe is a red herring, but I'd be
curious to know if it works.

    Close enough. :-)

FWIW...just trying to tie all this up into some useable recipe ;-)

Distilling the tips and discussions between Liviu and Bart (thanks to
you both) 
I seem to end up with:
########################
SHELL=/bin/ksh
:0
# some filters here...
# then:
| (formail \
 -rA"Content-Type: multipart/mixed\;

    You probably want "-rt" instead of simply "-r" here.

boundary=\"------------C1BC5999FB7A73F0B7EF99B8\""\
 -A"Mime-Version: 1.0";\
echo "";\
echo "This is a multi-part message in MIME format.";\
echo "--------------C1BC5999FB7A73F0B7EF99B8";\
echo "Content-Type: text/plain\; charset=us-ascii";\
echo "";\

    You only need one newline here (to separate "Content-Type:" from
"Content-Transfer-Encoding:"), not two.

echo "Content-Transfer-Encoding: 7bit";\
echo "";\
echo "heres some plain text message";\
echo "followed by the 'attached' file (inserted by mmencode)";\
ecgo "mmencode:
www.mit.edu/afs/athena/project/mime/mm2.7/src/metamail/";\
echo "";\
echo "--------------C1BC5999FB7A73F0B7EF99B8";\
echo "Content-Type: application/msword\; name=\"foo.doc\"";\
echo "Content-Transfer-Encoding: base64";\
echo "Content-Disposition: attachment\; filename=\"foo.doc\"";\
echo "";\
   mmencode -b < /path/to/foo.doc;\  # FILE ENCODED/ATTACHED

    Newline here.

echo "--------------C1BC5999FB7A73F0B7EF99B8--";\
echo "";\
) | $SENDMAIL -oi -t
########################

If there are futher mods, can you please post a useable recipe along
with your explainations?

    Ok, here we go (still not tested):

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

SHELL=/bin/sh

:0
# some filters here...
# then:
| (formail -rt -A "Mime-Version: 1.0" -A "Content-Type: multipart/mixed\; \
boundary=\"------------C1BC5999FB7A73F0B7EF99B8\"";\
echo "";\
echo "This is a multi-part message in MIME format.";\
echo "";\
echo "--------------C1BC5999FB7A73F0B7EF99B8";\
echo "Content-Type: text/plain\; charset=us-ascii";\
echo "Content-Transfer-Encoding: 7bit";\
echo "";\
echo "here's some plain text message";\
echo "followed by the 'attached' file (inserted by mmencode)";\
ecgo "mmencode: www.mit.edu/afs/athena/project/mime/mm2.7/src/metamail/";\
echo "";\
echo "--------------C1BC5999FB7A73F0B7EF99B8";\
echo "Content-Type: application/msword\; name=\"foo.doc\"";\
echo "Content-Transfer-Encoding: base64";\
echo "Content-Disposition: attachment\; filename=\"foo.doc\"";\
echo "";\
   mmencode -b < /path/to/foo.doc;\  # FILE ENCODED/ATTACHED
echo "";\
echo "--------------C1BC5999FB7A73F0B7EF99B8--";\
echo "";\
) | $SENDMAIL -oi -t

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


    Regards,

    Liviu Daia

-- 
Dr. Liviu Daia               e-mail:   daia(_at_)stoilow(_dot_)imar(_dot_)ro
Institute of Mathematics     web page: http://www.imar.ro/~daia
of the Romanian Academy      PGP key:  http://www.imar.ro/~daia/daia.asc

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