Operating System - HP-UX
1830207 Members
1616 Online
109999 Solutions
New Discussion

Re: how to email multiple attachments?

 
Jie Li
Frequent Advisor

how to email multiple attachments?

Good morning:

Thank you for all your help to resolve my email problem. My next question is how to email multiple attachments?

Thanks again
9 REPLIES 9
RAC_1
Honored Contributor

Re: how to email multiple attachments?

Option 1 - Get mpack
http://hpux.connect.org.uk

Option 2 - Some code

for i in 'file1 file2`
do
uuencode ${i} ${i}.txt | mailx -s "subject" abc@xyz.com
done

Option3 - Use email.

Anil
There is no substitute to HARDWORK
jpcast_real
Regular Advisor

Re: how to email multiple attachments?

Depending on the attachment you want to send it will be neccesary to modify the codification you use.

nemo:/home/jpcast> more envia2
#!/usr/bin/ksh
# Envio de mails de texto con sendmail
# ./envia2 "Subject" "Cuerpo del Mensaje" "Fich 1" "Fich 2" "destinatario"
# Envio de dos ficheros adjuntos a un destinatario
(
echo "To: $5"
echo "Subject: $1"
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/mixed; boundary="mimail""
echo "Content-Transfer-Encoding: 7bit"
echo ""
echo "--mimail"
echo "Content.Type: text/plain; charset=ISO-8859-1; name="BDY-TXT""
echo "Content-Disposition: inline; filename="BDY.TXT""
echo "Content-Transfer-Encoding: 7bit"
echo ""
echo " $2 "
echo ""
echo "--mimail"
echo "Content.Type: text/plain; charset=ISO-8859-1; name="$3.txt""
echo "Content-Disposition: attachment; filename="$3.txt""
echo "Content-Transfer-Encoding: 7bit"
echo ""
cat $3
echo "--mimail"
echo "Content.Type: text/plain; charset=ISO-8859-1; name="$4.txt""
echo "Content-Disposition: attachment; filename="$4.txt""
echo "Content-Transfer-Encoding: 7bit"
echo ""
cat $4
echo "--mimail--"
)| sendmail â t



I did once this script to send several attachments in the same mail modifying the encoding. This one is useful for text files .

There are another popular executable , called sendplus, which can help you to easily send attachemnts with the correct codificat
Here rests one who was not what he wanted and didn't want what he was
Prashant Zanwar_4
Respected Contributor

Re: how to email multiple attachments?

Try this:

if [ -s /home/pzanwar/mm* ]
then
ll /home/pzanwar/mm* |/usr/bin/mailx -s"Attached" my_email
fi

Hope it helps
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Muthukumar_5
Honored Contributor

Re: how to email multiple attachments?

We can do with uuencode system route there.

uuencode | mailx -s "subject" youruser@yorudomain.com
Easy to suggest when don't know about the problem!
BONNAFOUS Jean Marc
Trusted Contributor

Re: how to email multiple attachments?

Hi,

You can use uuencode command with mail(x) command to attach files. Search 'uuencode' in iITRC forums. You must found a lot of threads on this.

Regards
JMB
Si vous ne faites jamais de bétises, c'est que vous ne faites rien de difficile. Et ça c'est une grosse bétise.
Prashant Zanwar_4
Respected Contributor

Re: how to email multiple attachments?

http://www.sun.com/bigadmin/descAll/send_files_as_attac.html

This is good one, just for reference..Dont assign points on this pls.
It's almost repeated.

Thanks
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Muthukumar_5
Honored Contributor

Re: how to email multiple attachments?



Read more here about mail attachments on mailx as
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=678936

HTH.
Easy to suggest when don't know about the problem!
harry d brown jr
Honored Contributor

Re: how to email multiple attachments?


If the FILES are text files, and you want the recieving email user to get them as attachments, then you must fake the recieving email program out and tell it that they are "txt" files:

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

or if they are to be treated as is, then:

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

Either way, you MUST use the "-m" option on mailx.

live free or die
harry
Live Free or Die
A. Clay Stephenson
Acclaimed Contributor

Re: how to email multiple attachments?

Elm will work just fine from the command line and it's quite easy BUT you must make certain that there is a .elm directory in the sender's home directory. Elm invoked interactively will create the .elm directory automatically but elm under the command line will fail if .elm does does exist.


Within the body of your email add this:

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

This is my text. How are you?


[include /tmp/myattach application/octet-stream base64]

This is some more text in the middle.

[include /tmp/myexcel.xls application/ms-excel base64]

This is a closing message in the email.

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

That will attach the files "/tmp/myattach" and "/tmp/myexcel.xls" with the text of your message. If the above textfile were /tmp/my.text then you would do this:

cat /tmp/my.txt | elm -s "My Subject" mickeymouse@disney.com

to send your message along the the two files as attachments.
If it ain't broke, I can fix that.