how to send a attachment mail in unix

hi,

i have the code as below

#!/bin/sh

MAIL=/usr/bin/Mail

Mail_addr="aaa@bb.com"

Mail_file="/home/delta/dev/aa.doc"

${MAIL} -s " health check" ${Mail_addr} < ${Mail_file}

i want to send that Mail_file "/home/delta/dev/aa.doc" as attachment..
could u please suggest me for that ..

in above mail. it is going as composed text manner..

Have you tried searching the forum? This question is asked a lot.

maybe this line could help:

(cat message_email_body; uuencode aa.doc aa.doc) | mailx -s Subject email@tosend.com

hi,

i tried as below.. but still now working ...
can u plz help me ...

---------

#!/bin/sh

MAIL=/usr/bin/Mail

Mail_addr="aaa@bb.com"

uuencode /home/delta/dev/aa.doc | ${MAIL} -s "Configs" ${Mail_addr}

-------------

You need to specify the filename twice, as per Geller's example. However you should ojnly put the full path on the first one, e.g. uuencode /home/delta/dev/filename.doc attachmentname.doc.

Here is something you can try..

Create one file called message.txt which has the body of the email message.

Create the attachment file. Lets call it attachment_file.txt

Now use the following commands:

/usr/bin/uuencode attachment_file.txt email_attachment.lst > attachment.txt

#concatenate message.txt and attachment.txt into combined.txt

cat message.txt attachment.txt > combined.txt

#email combined.txt file. this file has the body of the email and the attachment

mail -s "Message with Attachment" <YOUR EMAIL> < combined.txt

Try this..

${MAIL} -s "health check" -a ${Mail_file} ${Mail_addr}

If you want to send the attachment with the mail body..

${MAIL} -s "health check" -a ${Mail_file} ${Mail_addr} < content_file

Thanks
Murugan