1833996 Members
2677 Online
110063 Solutions
New Discussion

Sendmail Attachments

 

Sendmail Attachments

Hi all,

I have a small script that emails a log to several people every week. I was wondering how I would attach a file to this email using just shell commands.

Thanks in advance,

Christian Briddon
6 REPLIES 6
harry d brown jr
Honored Contributor

Re: Sendmail Attachments

for i in `echo filename1 filename2 filename3 ...`
do
uuencode $i $i.txt
done|mailx -m -s "test" username@whereever.com



note the uuencode and the ".txt" at the end of the second $i, this allows the files to be seen as text files.


live free or die
harry
Live Free or Die
Uday_S_Ankolekar
Honored Contributor

Re: Sendmail Attachments

Hi
Try
/usr/bin/uuencode |mailx -m -s "Subject" user's email id

-USA..
Good Luck..
Helen French
Honored Contributor

Re: Sendmail Attachments

Hi,

Check this out:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xa7f93c853cd9d5118ff40090279cd0f9,00.html

HTH,
Shiju

Life is a promise, fulfill it!
Robin Wakefield
Honored Contributor

Re: Sendmail Attachments

Hi Christian,

Using straight sendmail:

(echo 'Subject:This is the subject

this is a test';uuencode /tmp/file /tmp/file.txt)| /usr/lib/sendmail robin.wakefield@ubsw.com

Note the Subject line has a blank line after it, and the uuencoded file has a .txt extension.

Rgds, Robin
Sanjay_6
Honored Contributor

Re: Sendmail Attachments

Hi,

Check out the top read solutions at the bottom in the hp-ux link,

http://forums.itrc.hp.com/cm/FamilyHome/1,11864,117,00.html

this is the thread,

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x41950559ff7cd4118fef0090279cd0f9,00.html

Hope this helps.

Regds

Re: Sendmail Attachments

Thanks everyone, that is a great help.

I have allocated points to you all.

Cheers,

Christian