Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 


Go to solution
Alan Karelitz
Occasional Visitor


I am attempting to attach a text file report to a email message as an attachement. Using the following command:

uuencode /etc/hosts hosts.txt|sendmail

Sends the file as an attachment, but the file no longer looks like the source. Looks like it's a unix character tranlation issue.

Any ideas on how I can get this to work?


Alan Karelitz
Berlene Herren
Honored Contributor

Re: Attachments

Perhaps MIME functionality is not set up in sendmail?

Add the following lines to /usr/share/lib/mailx.rc

set charset=X-roman8
set charset=us-ascii

Then stop and restart sendmail

John Palmer
Honored Contributor

Re: Attachments

If you are sending the file to a windows platform then you will need to (at least)convert the NL that UNIX uses to CRLF that windows uses as a record separator. This is because the uuencode technique effectively does a 'binary' copy similar to ftp.

Try converting the file with 'ux2dos' first.
Rita C Workman
Honored Contributor

Re: Attachments

This is something we do alot here..because we send reports (and images) via elm as part of the jobstreams for production. I don't know if you'll care for this approach, but we like

.Yes- you can send a file as a TRUE file
attachment and actually preserve what the file is
the info:
First make sure you at least have Elm 2.4 on your box,
and my example is for a HPUX 10.20 (you need MIME
capability) so be sure you have patch PHNE_15835 (it
doesn't cause a reboot to load).
The next thing you have to do is create a small file (ex
include.file) that is used to send the file as an attachment.
There are a few things you could read on this for more
details at HP's IT Resource if you want. But simple create
a file with this syntax:
[include text.txt text/plain base64]

where text.txt is your file.

The general format is: [include filename type/subtype
type/subtype= text/plain, image/gif, image/jgp etc..
encoding=base64, quoted-printable etc...
Another example might be for a Word doc:
[include file.doc application/msword base64]

Now from the command line to send this file as an
attachment to user_abc:

elms -s 'Test attachment file' ============================================
What this did was email to the
file test.txt with a subject line of Test attachment file. If you
sent a Word doc it would come across and be a Word file
You can do it with text files; image.jpg or gif files; and
more. ....It's a real paper saver.

Alan Karelitz
Occasional Visitor

Re: Attachments


I tried your suggeston, but it had no effect.
Alan Karelitz
Occasional Visitor

Re: Attachments


The method that you suggested worked very well, but I can't be sure that the end users is going to be on a Windows Platform.