Two things to remeber:
1) When using the "uuencode command you must supply two file names. The "file.txt" is the name of the file you want to send and "file1.txt" can be any name you wish but must be different from the name given to "file.txt". The "file1.txt" will be the name whcih you will see as an attachement in your email.

2) The uuencode command when treating text fisles will force you to further manipulate the file once it gets on your PC. You see text files in UNIX end each line ends with a "carridge return" character were as in Windows world each line in a text file ends with a "carridge return and line feed". If you do not change the carridge return to carridge return , line feed on the PC/Windows you will see only one line when you open that file with wordpad or notepad so be warned.

Hi,
Yes, I use redirect to mailx also when there is no formatting in file. However I use the uuencode method also when I want to place data in excel. By sending the data in an attachment it is easy to load as delimitted or field set length.

MAILX (and SMTP) does NOT have the ability to attach files to email.
That's always been a function of the clients, and their standards.

Take a look at MIME, it's a way to encode whatever file you want to
attach, into a form that can be carried in the body of the SMTP email.

That's the closest you get to attaching a file to a unix email.
Remember, you may ALSO run into size of file limitations in UNIX email.
Depends on your and their server, but it could force you to split the
file you want to attach.

Posted by DrewBaecker (Senior HP-ux Admin.)
on Jan 21 at 8:16 AM
Mark as helpful
As long as it's a text file all you have to do is re-direct it into
mailx.
mailx -s " Subject " email@removed < /tmp/test.txt
The test.txt will come out as the body of the E-mail. I use this all
the time in scripts for sending log files.

Hi Roger
Sorry about mailx not working for you it works fine for me. I have never encountered this type of issue. Ever since I can remember this command has worked for me. Need to look into why mailx is not available on your servers. Once again my apologies for my response.
Regards

Copyright 1998-2015 Ziff Davis, LLC (Toolbox.com). All rights reserved. All product names are trademarks of their respective companies. Toolbox.com is not
affiliated with or endorsed by any company listed at this site.