Messaging
cancel
Showing results for 
Search instead for 
Did you mean: 

Use of sendmail and uuencode

SOLVED
Go to solution
Gabriel Hermida
Occasional Advisor

Use of sendmail and uuencode

Hello.
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 yahoo.com 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.

Bye.

Gabriel
10 REPLIES
Rick Garland
Honored Contributor

Re: Use of sendmail and uuencode

If it just a text file you are sending, no need to uuencode the file.
Just read it in using the mailx command option of "~r "

If sending binary files, there is "mutt" that will allow you to attach files.
Gabriel Hermida
Occasional Advisor

Re: Use of sendmail and uuencode

Thanks for your answer, but I need the files to appears like an attachment, using mailx in the command line, because I have to implement and automatic process to send the messages.
Rick Garland
Honored Contributor

Re: Use of sendmail and uuencode

Check into mutt. This will "attach" files, either binary or text.

Re: Use of sendmail and uuencode

Hi !
Try
"uuencode file file | mailx -m -s subject user@host"

Without -m , mailx produces MIME-Headers.

Greetings,
schneck
Gabriel Hermida
Occasional Advisor

Re: Use of sendmail and uuencode

Hello.

As you said, the file is an ASCII file. The problem is that the file is too large in some cases, so I can?t include it in the body message, but like an attachment.

I try with the -m option of mailx, but ins no supported by HPUX. It says:

mailx: illegal option -- m
usage: mailx [-FU] [-s subject] [-r address] [-h number] address ...
mailx -e
mailx [-UHiNn] [-u user]
mailx -f [-UHiNn] [filename]

With uuencode, it works with one mail cliente, but it has problems with all others.

Aditionally, I have to send the message with the attachment by the command line, because is a batch process.

Thanks for ypur help.
Bye
Gabriel
Ralf Hildebrandt
Valued Contributor

Re: Use of sendmail and uuencode

Check for mpack and munpack on a HP-UX porting cetre
Postfix/BIND/Security/IDS/Scanner, you name it...
Olaf Stransky
Occasional Contributor
Solution

Re: Use of sendmail and uuencode

Hi!

try do do it with 'mpack'
(ftp.andrew.cmu.edu:pub/mpack/).

In my batch-job it works like this:
mpack -s "$MAIL_SUBJEKT" -d $MAIL_BOTTOM $FILE $ADDRESS
where
MAIL_SUBJEKT is the subject (generated in the Script),
MAIL_BOTTOM is a text-file containing the text of the mail
FILE is the file to attach
ADDRESS is the address (as you would have expected :-))

This works fine.

BUT: Has enyone experience with sending more then one attachment in a batch-job without making things like a ZIP-File???
The more i know NT, the more I love UNIX!
Anthony deRito
Respected Contributor

Re: Use of sendmail and uuencode

To send multiple attachments, create a file with the following contents:

Subject: ADD SUBJECT HERE
MIME-Version: 1.0
Content-type: multipart/mixed;boundary="zzzz"
Content-Transfer-Encoding: 7bit

--zzzz
Content-Type: text/plain; charset=US-ASCII; name="bdy.TXT"
Content-Disposition: inline; filename="bdy.TXT"
Content-Transfer-Encoding: 7bit

ADD BODY TEXT HERE

--zzzz
Content-Type: text/plain; charset=US-ASCII; name="FILENAME1.TXT"
Content-Disposition: inline; filename="FILENAME1.TXT"
Content-Transfer-Encoding: 7bit

ADD ASCII TEXT FOR FIRST ATTACHMENT HERE

--zzzz
Content-Type: text/plain; charset=US-ASCII; name="FILENAME2.TXT"
Content-Disposition: attachment; filename="FILENAME2.TXT"
Content-Transfer-Encoding: 7bit

ADD ASCII TEXT OF SECOND ATTACHMENT HERE

--zzzz--



The zzzz strings are very important. Use the exact text as listed while filling in the filenames. Looks messy but it works.
Alan Riggs
Honored Contributor

Re: Use of sendmail and uuencode

You can also use:

sendmail abc@xyz.com << END
`cat message.file`
`uuencode file1 attachment1`
`uuencode file2 attachment2`
`uuencode file3 attachment3`
END
Gabriel Hermida
Occasional Advisor

Re: Use of sendmail and uuencode

Hi.
I've been working with mpack and it works fine. The mail messages has been received well by all mail clients I try.
Working with sendmail or mailx, not all clients works well.
Thanks to all for your answers.
Bye.
Gabriel.