[SunHELP] Sendmail and KSH

Will Mc Donald wmcdonald at ntlworld.com
Fri Apr 5 17:41:37 CST 2002


Heh, coincidentaly I've been doing that this week.

With the help of one of the development lads here at work we've (well, mostly
he) turned out the script listed below.

This may not be 100% RFC compliant, I know kmail whines a little but it should
give you a general guideline.

---------------BEGIN SCRIPT---------------
#!/bin/sh
#
#
# Build the body of the multi-part mail message and whack that out
# to Sendmail

{
cat << EOF
From: "Admin" <admin at domain.blah>
To: "Destination Address." <destination at otherdomain.blah>
Subject: [whatever the subject is]
Date: `date`
MIME-Version: 1.0
Content-Type: multipart/mixed;
        boundary="--schnee.buh"

This is a multi-part message in MIME format.

----schnee.buh
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

See attached.

EOF

for file in `ls /directory/subdirectory`
do
cat << MPB
----schnee.buh
Content-Type: text/plain;
        name=`basename $file`
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
        filename=`basename $file`

`cat $file`

MPB
done
} | /usr/lib/sendmail -t -f admin at domain.blah destination at otherdomain.blah

---------------END SCRIPT---------------

Will.


----- Original Message -----
From: "Miley, Shain" <SMiley at czn.com>
To: <sunhelp at sunhelp.org>
Sent: Friday, April 05, 2002 8:38 PM
Subject: [SunHELP] Sendmail and KSH


> Hello,
> Can someone point me toward a doc that gives some detail about how to send
> email with sendmail from a KSH script?



More information about the SunHELP mailing list