Showing results for 
Search instead for 
Did you mean: 

Use of sendmail and uuencode

Gabriel Hermida
Occasional Advisor

Use of sendmail and uuencode

I've been working with uuencode and mailx and I've used it with mailx to insert a file to a mail item with the next commands:

$uuencode file.txt file.txt >> item
$cat item | mailx -s 'subject' recipient@maildomain

where item contains the message text.

It works fine with our mail system, SoftArc First Class, but with other mail like and others, the file attached appears at the bottom of the text message in MIME format, not like and attach file.

I have to send mail to many mail clients and I want to know if there is a method to attach files that can be read by the major number of them.

Thanks for your responses.


Mike McKinlay
Honored Contributor

Re: Use of sendmail and uuencode

Are you sending binary files? That's really the only reason to use uuencode or base64 (MIME) encoding.

If you're simply sending ASCII text data (per your example), you should be able to run

cat text.txt | mailx -s subject
"Hope springs eternal."

Re: Use of sendmail and uuencode

Hi !
I think the problem is that mailx always adds MIME-headers when not using the "-m" Option.
Try this :
echo "This mail contains a uuencoded attachment ..."
uuencode file.txt file.txt
) | mailx -m -s 'subject' user@host

Hope it helps,
Rita C Workman
Honored Contributor

Re: Use of sendmail and uuencode

Well if you want to just send a file as part of the message,
than any of the other responses will work just fine.
BUT...if your trying to attach a file and send the file via
sendmail as an attachment than you can do this also.
First make sure you at least have Elm 2.4 on your box,
and my example is for
a HPUX 10.2 (you need MIME capability) so be sure you
have patch PHNE_15835 (it doesn't cause a reboot to
load). To give you an example I ftp'd an excel
spreadsheet to my box called test.xls Then I did the
First create a dummy file with the following line (just as
you see it here)
[include test.xls application/msexcel base64]
Second from the command line:
elm -s "This is a test" ============================================

What this did was email to the file test.xls
(and it comes as attached excel file) with a subject line of
This is a test. It works.
You can do it with text files; image.jpg or gif files; and
more. Might want to do some
lookups on IT Resource for more info.
It's a very handy tool that programmers can add right into
the job streams and email reports to users instead of
printing them....makes for paperless environment.