Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending more than one attahment via mailx

Status
Not open for further replies.

RJSHA1

Programmer
Apr 12, 2001
66
0
0
GB
Hi there,
I have been looking through the forum at how to use mailx to send an attachment to an e-mail user and the fact that you need to use uuencode to uncode the mail, but how would I send two attachments in the one e-mail; is it possible ?????
 
RJSHA1,

Using the example below, you would just need to add another uuencode line:
Code:
#!/bin/ksh

export TO=someone@somewhere.com
export FILE=myfile.dat

( cat <<-MSG
Hi There,

Please find the attached file ${FILE} as of $(date).

Cheers.
MSG
uuencode ${FILE} ${FILE}
) | mailx -s "${FILE} as of $(date)" ${TO}

so it would be:

Code:
#!/bin/ksh

export TO=someone@somewhere.com
export FILE=myfile.dat
export FILE2=myfile2.dat

( cat <<-MSG
Hi There,

Please find the attached file ${FILE} as of $(date).

Cheers.
MSG
uuencode ${FILE} ${FILE}
uuencode ${FILE2} ${FILE2}
) | mailx -s "${FILE} and ${FILE2} as of $(date)" ${TO}

John
 
Hi john,
Sorry I'm being silly here surely the the -s is the subject line option, I can't see how you would get two files created from the second section of code.
also I have the two files created - why is there a pipe in the script before the mailx ???
 
RJSHA1,

You are encoding 2 files and piping them to mailx to be used as input which will be displayed as attachments.

Try it...It works.

John
 
Hi john,
Thi is my code -

uuencode repfile repfile.doc > RESPREP
cat RESPREP | mailx -r $CCRECEIP -s "AFT User $USER $CTM_ODATE AFT Input Response" $CCRECEIP $RECEIP


What do I need to add in to send the second attachment.
Regards
Bob...

 
RJSHA1,

Try:

uuencode repfile repfile.doc > RESPREP
uuencode repfile another_file.doc >> RESPREP
cat RESPREP | mailx -r $CCRECEIP -s "AFT User $USER $CTM_ODATE AFT Input Response" $CCRECEIP $RECEIP

John
 
Hi John,
Does it matter that one of the files is a pdf file ???


Bob....
 
uuencode is used for ANY type of file.
You may try something like this:
(uuencode repfile.doc repfile.doc;uuencode repfile.pdf repfile.pdf) |
mailx -r $CCRECEIP -s "AFT User $USER $CTM_ODATE AFT Input Response" $CCRECEIP $RECEIP


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top