Attaching files in Mail with HP Unix

I am trying to attach a .xls file using uuencode in HP Unix
uuencode res1.xls res1.xls | mailx abc@xyz.com

But in the receiving end, I couldn't see the attachement, instead of it some encoded text is there in the body of mail

Can anybody suggest how to attach the files in HP Unix. I don't have MIME package installed, and we can't use.

Here is a part of my script. I use this script to send a .html file as an attachment.

DIR_FILES=/yourdir
EMAIL_TO=user@user.com
EMAIL_FROM=fromuser@user.com
ATTACHED_FILE=test.html
EMAIL_SUBJECT="The subject"
EMAIL_TEXT="Your text"
E_MESS=mail.tmp


echo "To:      $EMAIL_TO" > $DIR_FILES/$E_MESS
echo "From:    $EMAIL_FROM" >> $DIR_FILES/$E_MESS
echo "Subject: $EMAIL_SUBJECT" >> $DIR_FILES/$E_MESS
echo "" >> $DIR_FILES/$E_MESS
echo $EMAIL_TEXT >> $DIR_FILES/$E_MESS

uuencode $DIR_FILES/$ATTACHED_FILE $ATTACHED_FILE >> $DIR_FILES/$E_MESS
cat $DIR_FILES/$E_MESS | /usr/sbin/sendmail -t

try this

uuencode one.xls > mailattatch
uuencode two.xls >> mailattatch
cat mailattatch | mailx -s "Subject ...." xyz@mail.com

See this script in the FAQ.

You can try with this script....this will show you how to enter subject ,body and attachment.

FILE_NAME="one.xls"
`cat > mail_filewatcher.log <<!
Team - Here is the action to be taken based on this mail.
Please work on the exceptions listed in the attachment to ensure.

 THIS IS A SYSTEM GENERATED E-MAIL...PLEASE DO NOT REPLY.
 !\`

uuencode ${FILE_NAME} ${FILE_NAME}>>mail_filewatcher.log
mailx -s "enter your subject " mailid@xyz.com < mail_filewatcher.log

mutt is your friend :smiley:

creating test attachment file
$ echo "this is the attachment file" > attatch.file
creating test body file
$ echo "this is the body" > body.file

sending mail w/following command
$ mutt -a attatch.file -s "this is the subject" user@emailADDY.com <body.file

no i tried this and i did not recvd any attachments in the mail... instead i recvd ...... the content of the file in the body of the mail...............

can anyone guide me .... how could i send a file as an attachment thru unix to outlook...... or any mailbox?????

regards,
vangalli

Have you tried the script above posted by me i have checked this on outlook as well lotus notes.And got the attachment and body as expected.

can you paste your code let us see and check with your code...

Hi

Please try this one . This works from sending mail from Solaris box to MS Outlook

uuencode file_to_be_snt_as_attachment file_name_you_want2b_seen_in_attachemnt | mailx -s "Hi" "xxx@yyy.com"

uuencode :- is the unix command to encode a file for sending as an attachment.

file_to_be_snt_as_attachment :- is the name of the file you want to attach

file_name_you_want2b_seen_in_attachemnt :- once you receive the mail you see this name in the attached file. (Note :- This could be the same as argument 1).

mailx -s :- -s is for the subject and then the mail id

Hope this helps. This works in solaris to MS Outlook and to Lotus notes.

i have renamed it to rg.xls

then used command....

uuencode rg.xls rg.xls
cat rg.xls | mailx -s "TEST" name@name.com

and i haven't recvd any attachment... instead i recvd just body of the file in message boc of my email....

please advice me

With the code you have posted i am also getting output in body of mail.Can you try this....

uuencode rg.xls rg.xls>t1.log
mailx -s "TEST" urmail@com <t1.log

Again, see this script in the FAQ. Perderabo, explained exactly why this happens.

no :frowning: i could not found any result.............. i got an output in mailbox message box as below:

begin 640 rg.xls
086)C?'AY>@HQ,C-\86YD"G?_
`
end

the command I used was

uuencode rg.xls rg.xls
cat rg.xls | mailx -s "TEST" name@name.com