Operating System - HP-UX
1850524 Members
2759 Online
104054 Solutions
New Discussion

Re: Attach files using elm or mailx

 
SOLVED
Go to solution
Belinda Dermody
Super Advisor

Attach files using elm or mailx

The search engine is kaput again. So I will have to ask the question first. HP9000 K200 box 10.20 HPUX, is there anyway that you can attach files when using elm or mailx in scripts.
13 REPLIES 13
Craig Rants
Honored Contributor

Re: Attach files using elm or mailx

James,
Follow this thread. Should be exactly what you are looking for.

Good Luck,
C

http://forums.itrc.hp.com/cm/QuestionAnswer/1,11866,0x62f2c6af36b7d5118ff10090279cd0f9,00.html
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Craig Rants
Honored Contributor

Re: Attach files using elm or mailx

I actually have a script I use for this.

#!/bin/sh
MAILFILE=/tmp/mailtemp
HEADER=/tmp/header

clear
echo "Enter the email address: \c"
read TO
echo "Enter the Cc email address: \c"
read CC
echo "Enter the Bcc email address: \c"
read BCC
echo "Enter the Subject: \c"
read SUBJECT
echo "Enter the Body: \c"
read BODY
echo "Enter the filename of the attachment: \c"
read DATAFILE

echo To: $TO >> $HEADER
echo Cc: $CC >> $HEADER
echo Bcc: $BCC >> $HEADER
echo Subject: $SUBJECT >> $HEADER
echo "" >> $HEADER
echo "" >> $HEADER
echo $BODY >> $HEADER
echo "" >> $HEADER

cat $HEADER > $MAILFILE
uuencode $DATAFILE $DATAFILE.doc >> $MAILFILE
cat $MAILFILE | /usr/lib/sendmail -t
rm $MAILFILE
rm $HEADER

C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Sridhar Bhaskarla
Honored Contributor

Re: Attach files using elm or mailx

You can use uuencode to attach files.

uuencode file |mailx -s "The file" email_id

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: Attach files using elm or mailx

The example should be

uuencode file file| mailx -s "file " email_id

-Sri

You may be disappointed if you fail, but you are doomed if you don't try
Deshpande Prashant
Honored Contributor
Solution

Re: Attach files using elm or mailx

HI
Try this
#/usr/bin/uuencode file file |mailx -m -s "The Subject" your_email_id

Prashant.
Take it as it comes.
Belinda Dermody
Super Advisor

Re: Attach files using elm or mailx

Thanks for all the fast information. The one that I am trying to use is elm with the include. I downloaded and installed PATCH PHNE_15835 and I have it working, but my only concern now is I get the text msg in the body as well as an attachment. Is there someway that I can avoid the full msg in the body, as some of them are quite large.
Tracey
Trusted Contributor

Re: Attach files using elm or mailx

I use an include file that has the text:

[inlcude filename text/plain quoted/printable]

where of course filename is your file. The include file I will name something like file_email and then use the command:

mailx tracey
Tracey
Trusted Contributor

Re: Attach files using elm or mailx

Oops, forgot to mention that it works with elm the same way on 11.x. Not sure if it works with mailx on systems with 10.x OS's.
Belinda Dermody
Super Advisor

Re: Attach files using elm or mailx

Tracy thanks for the input, I have problems putting out the full explanation. I am sending this mail to Outlook. When the message comes in to my outlook in folder. The attachment is there like I want it to, but also the body of the message is the full text message of the attachment. What I would like is just the attachment without the body part.
Christopher McCray_1
Honored Contributor

Re: Attach files using elm or mailx

Here is how you can do it as I know it, but you have to go int elm:

1) go into elm
2) m)ail a message, fill out the to, subject, etc.
3) you will then go into vi, where you can draft a message, wq out when done.
4) you will then see a set of options at the bottom of your screen, among those is a)ttachments, select it.
5) you will go to a screen where you have more options at the bottom, among those is a)dd, type a and at filename:, enter the path of the filename and hit return and then hit return again to get the menu selections mentioned above. If you are done, choose q)uit.
6) You should be back to the menus dscribed in #4, if you are ready to send, choose s)end.


This seems pretty long and drawn out, but it has worked for me with things I have wanted to send. Give it a try, what have you got to lose?

Good luck

Chris
It wasn't me!!!!
Rita C Workman
Honored Contributor

Re: Attach files using elm or mailx

This is one of my favorite subjects...
There are a couple ways to do this ..
You can use uuencode (as was mentioned)
You can use a third party..some folks like MPack
But my personal favorite is using the include statement..which is where Craig's thread will point you.

I've attached a script I wrote awhile back for myself to run a bunch of performance reports for a vendor and email all those reports as attached files...Maybe it would give you a couple ideas..

Regards,
Rita
Deshpande Prashant
Honored Contributor

Re: Attach files using elm or mailx

HI
I use following command to get file only in attachment in outlook as well as in lotus notes.

#/usr/bin/uuencode file file |mailx -m -s "The Subject" your_email_id

Thanks.
Prashant.
Take it as it comes.