Script needed which will send a mail with attachment files

Hello,

I need a shell script which need to send a mail with 4 *.csv files as attachments.Anybody can help me?

At present i have a script which is sending only one file as attachments.But i need a script which send 4 files in a shot.

#!/bin/ksh

/bin/mail xxxx@xx.xom << EOF
Subject: Test
To: "xxxx@xx.xom"
MIME-Version: 1.0
Content-Type: Multipart/Mixed; boundary="MY_LONG_BOUNDARY_LINE"

--MY_LONG_BOUNDARY_LINE

`/usr/bin/cat mail_body.txt`

--MY_LONG_BOUNDARY_LINE
Content-Type: text/plain; charset=us-ascii; NAME=zzz.csv;
Content-transfer-encoding: x-uuencode

`/usr/bin/uuencode /fullpath/zz.csv zz.csv`

--MY_LONG_BOUNDARY_LINE--

EOF

Any help will be appreciated.

Thanks
K

Start your exploration here:

Quick work-around would be to tar the files and sent the tar-file as the attachment.

HTH :b:

EMAIL="Email@address.com"
MSG="Message:BODY of the Text"
echo "$MSG"
echo "Mail Sent to $EMAIL"
uuencode Path/to/file.csv file.csv>msg.csv
echo "$MSG">msg

cat msg msg.csv >email.msg

mailx -s "Test Email" $EMAIL <email.msg
rm msg
rm email.msg

You can create a single attachment from any number of files to attach:

  1. tar all the attachments
  2. uuencode the tar-file
  3. sed the output of uuencode attached to the mail.

bakunin