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. :-)
:0
| (formail -A"Content-Type: multipart/mixed\;
boundary="------------C1BC5999FB7A73F0B7EF99B8";\
You also need a "Mime-Version: 1.0" header. Some MTAs relay on
that.
# may also -need- content-length: header??
Don't. Some [*insert your favorite deprecatory adjective here*]
gateways will mess with it sooner or later.
echo "";\
echo "This is a multi-part message in MIME format.";\
Nah, that's a Pine-ism, just replace it by another "echo ;\" (BTW,
"echo" without arguments still prints a newline, you don't need the
empty string).
echo "--------------C1BC5999FB7A73F0B7EF99B8";\
echo "Content-Type: text/plain; charset=us-ascii
Add a newline here.
Content-Transfer-Encoding: 7bit"; \
echo "";\
echo "heres some plain text message";\
echo "followed by the 'attached' file (inserted by 'cat filename')";\
Another newline here.
echo "--------------C1BC5999FB7A73F0B7EF99B8";\
echo "Content-Type: application/msword";\
echo " name=\"foo.doc\"";\
Don't write the name twice, forget about "name=..." and just use
"Content-Disposition:".
echo "Content-Transfer-Encoding: base64";\
echo "Content-Disposition: inline\;";\
Use "attachment" instead of "inline". From RFC 2183:
:2.1 The Inline Disposition Type
:
: A bodypart should be marked `inline' if it is intended to be
: displayed automatically upon display of the message.
For a generic "foo.doc" attachment, this may or may not be true.
echo " filename=\"foo.doc\"";\
Newline here.
cat /path/to/foo.doc;\ # HERES WHERE THE FILE GETS INSERTED
Replace that by
mmencode </path/to/foo.doc;\
echo ;\
echo "--------------C1BC5999FB7A73F0B7EF99B8--";\
And a final newline here.
) | $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