Operating System - HP-UX
1829716 Members
2480 Online
109992 Solutions
New Discussion

uuencode with message body

 
SOLVED
Go to solution
MattJ123
Frequent Advisor

uuencode with message body

I'm attempting to send a file as an attatchment with mailx. For example:
uuencode filename.txt attachmentname.txt | mailx -s "filename" email@address

This leaves little room for a message body. I've attempted with a heredoc, which doesn't seem to work very well, for example:

mailx -s "filename" email@address <Message body
This is some text
`uuencode filename.txt attachment.txt`
EOF

Does another way exist where I can have a message body with a uuencoded attachment?
5 REPLIES 5
Stuart Urquhart
Frequent Advisor

Re: uuencode with message body

Try adding -m to mailx :-
uuencode filename.txt attachmentname.txt | mailx -m -s "filename" email@address

You might also need to ux2dos the file depending what you're reading it with at the other end :-

cat filename | ux2dos | uuencode attachmentname.txt | mailx -m -s "filename" email@address
Fred Ruffet
Honored Contributor
Solution

Re: uuencode with message body

mailx -m -s "passwd file" email@adress
Place some text here
~
--

"Reality is just a point of view." (P. K. D.)
Geoff Wild
Honored Contributor

Re: uuencode with message body

Try mpack:

http://hpux.cs.utah.edu/hppd/hpux/Users/mpack-1.5/

Rgds....Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Steven E. Protter
Exalted Contributor

Re: uuencode with message body

The script I'm attaching will do the job. It has more features than you want, but it has the advantage of being production and working.

Note that uuencode problems can sometimes happen due to smtp relay servers not being up to date on patching.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
MattJ123
Frequent Advisor

Re: uuencode with message body

Well, since this may be called from shell or perl I have the following working examples below.. Thanks for the help everybody!
------------------
#!/usr/bin/sh
mailx -s "test" email@address.com <SHELL TEST
~