Operating System - HP-UX
1833757 Members
2799 Online
110063 Solutions
New Discussion

Re: How to send an email with multiple attachements.

 
SOLVED
Go to solution
Mark Blonde
Advisor

How to send an email with multiple attachements.

Good Afternoon all,
I was wondering how it could be possible on a HP-UX 10.20 Operating System to send multiple email attachements in 1 email. Here is the email I have right now. The problem is that only 1 attachement is sent. PLZ help!!!

(
echo "From:xxxx"
echo "To: xxxx"
echo "Subject: Test"
echo "\nPlease find enclosed login information required to use....."

uuencode doc1.doc doc2.doc) | /usr/sbin/sendmail xxxxx@site.ca
If you don't have what you want, want what you have.
6 REPLIES 6
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: How to send an email with multiple attachements.

My standard method is to use elm from the command line.

Simply include the following syntax in your mail textfile (e.g) my_message

-----------------
This is some sample text.
[include myfile1 application/octet-stream]

This is some more stuff.

[include myfile2 application/octet-stream]

That's all folks
------------------

Then, elm -s "Sample Subject" somebody@abc.com < my_message

The above will generate 2 separate attachments.

The only requirement is that you must first create a .elm directory in the sender's home directory; the command-line version will not automatically create the .elm directory unlike the interactive version of elm. The above will attach myfile1 and myfile2. You must also have a MIME enabled version of elm (PHNE-15835 or later on 10.20).


If it ain't broke, I can fix that.
MANOJ SRIVASTAVA
Honored Contributor

Re: How to send an email with multiple attachements.

Hi Mark


Please look at this document :


http://www3.primushost.com/~kylet/unix-att.html


Z-Mail - The grand daddy of all email user agents. :-) This is using the zmail.small binary that has none of the GUI code so it uses less resources to run.
For a single file:

cat $TXTFILE | zmail.small -subject "$SUBJECT" -attach application/octet-stream:${ATTFILE} $MAILTO

Bart Schaefer offers the following for multiple attachments. (untested by myself)

zmail.small -rf /dev/null -e 'mail -z -s "$SUBJECT" $MAILTO' -e 'compcmd attach-file $ATTACHFILE application/msword base64 "$DESCRIPTION"' \ -e! 'compcmd send'

You can repeat the -e 'compcmd attach-file ...' as often as necessary to
attach more than one file. The -z in the mail command tells it not to
go interactive, but rather to wait for compcmds to tell it what to do.


Manoj Srivastava
Michael Tully
Honored Contributor

Re: How to send an email with multiple attachements.

Hi,

Here is fairly simple method for sending multiple files.

for e in `echo file1 file2 file3`
do
uuencode $e $e.txt
done|mailx -m -s "mymail" username@domain.com

Change ".txt" to the proper format of the file e.g. .xls for excel, .doc for word etc

HTH
~Michael~
Anyone for a Mutiny ?
harry d brown jr
Honored Contributor

Re: How to send an email with multiple attachements.

Mark,

Your line:

uuencode doc1.doc doc2.doc

is encoding the the doc1.doc and renaming it doc2.doc.

It's important, for your END-USER's mail program to have the CORRECT suffix on files. Fortunately M$ Word can handle a text file, even though it's named SOMETHING.doc, but had it been .pdf, it would have failed.


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


The key is to have the right "suffix" on the uuencode line:

uuencode filename filename.txt


live free or die
harry
Live Free or Die
Aashish Raj
Valued Contributor

Re: How to send an email with multiple attachements.

u can do the following
mailx -s "multiple attachments" abc@xyz.com <This is the first attachment sent as word doc
~< !uuencode /tmp/file1.txt file1.doc

This is the second attachment sent as wordpad
~< !uuencode /tmp/file2.txt file2.txt
EOF

Thanks
AR
Rich Wright
Trusted Contributor

Re: How to send an email with multiple attachements.

My favorite way...
mailx -m -s "Subject text" $sendto 1>/dev/null << __EOF__

First attachment
$(cat $textfile | ux2dos - | uuencode ${program}.txt)


Second attachment
$(cat $binfile | uuencode ${binfile})

Rest of message
__EOF__