1752290 Members
4634 Online
108786 Solutions
New Discussion юеВ

Re: uuencode

 
roger_101
Occasional Contributor

uuencode

Hi

We have an application that creates a file in a MS Word format on an HPUX 11.x server. The file is mailed by mailx to users on several mail systems. All users except those running Microsoft Exchange are able to receive the file as an attachment and open it succesfully. The Excange users open the attachment but get garbled text.
The command we use to mail the file is:
uuencode file.doc file2.doc | mailx -s"subject" mail.group

Has anyone else seen this problem?

Thanks
10 REPLIES 10
Victor BERRIDGE
Honored Contributor

Re: uuencode

Hi,
Have you tried with a .mailrc file containing:
set crt=21
set encoding=8bit
set charset=iso-8859-1
# set mimeheader=yes

Just thoughts
all the best
Victor
roger_101
Occasional Contributor

Re: uuencode

Tried the .mailrc syntax - did not work.
Victor BERRIDGE
Honored Contributor

Re: uuencode

Have you tried to ux2dos the file before the uuecode?

Just thoughts...
Victor
Victor BERRIDGE
Honored Contributor

Re: uuencode

Have you tried with the sendmail -t option?

I found this DOC...
All the best
Victor

Command-line mailing with subject, body text and attachments DocId: KBAN00000679 Updated: 20010420

DOCUMENT
PROBLEM:

Customer wants to be able to create a script to email a binary file to a
distribution list, with a subject line so recipients can readily identify it,
and body text explaining what the attachment is and what to do with it. To do
that, they need a method of creating and sending such a message.

RESOLUTION:

The method involves assembling a message from two separate parts, consisting of
a header which contains the body text and of a uuencoded attachment, then
sending it using the "-t" sendmail flag, which causes sendmail to scan the
message body for such things as addresses and the subject.

The first part of the message is a header, which looks like this:

To:

Cc:

Bcc:

Subject:

Then beginning on this line, you write the body text you want to include.


As you can see, the customer could easily put together a template header file
with variables in key positions, so a script to create and send the messages
could just grab the template and substitute the necessary values for the
variables. It's not necessary to include bcc or cc lines if they're not going
to be used.

Creating the message, then, is a matter of appropriately modifying a copy of
the header, and writing it to a temporary file. Then uuencode the attachment
file and ">>" redirect it to the same temporary file. Now send the contents of
that temporary file to sendmail, using the "-t" flag.

For example, let's say you have a report that you always send to the same
people, always using the same body text and subject line. For that you could
create a fixed header file, called "header" in this example. To distribute the
report:

# cp header > /var/tmp/mailtemp
# uuencode /path/datafile datafile >> /var/tmp/mailtemp
# cat /var/tmp/mailtemp | sendmail -t
# rm /var/tmp/mailtemp

That's all. Because of the "-t" flag, sendmail will read the header for
addressing and subject information. Uuencoded files with a ".csv" suffix sent
in testing arrived at an Outlook client as attachments which called up Excel
just as they should, while the body text part of the header file arrived as
body text.

Aliases were mentioned above in the description of the header. This is part of
sendmail, and works whether you're sending mail using sendmail alone, or with
ELM or mail or mailx or any client using sendmail as a transport vehicle.
In /etc/mail there's a file called "aliases," and in it you can define both
individual aliases and mailing lists. The basic format can be seen by just
looking at the file or consulting the man page for aliases(5). To define a
list, you start the line with the alias for the list, then after a ":"
delimiter, list the addressees (full address or alias) separated by commas.
It's okay to add a space after the comma for clarity. All addresses have to be
on the same line as the alias for the list; a new line is taken as the end of
the list. Sendmail doesn't usually use the aliases file itself, though, but
rather "aliases.db," so after you're done editing the aliases file you have to
issue the command "newaliases" to re-read the aliases file and re-write the
aliases.db file.
harry d brown jr
Honored Contributor

Re: uuencode

Add the "-m" flag to mailx

change to:

uuencode file.doc file2.doc | mailx -m -s "subject" mail.group

live free or die
harry
Live Free or Die
TwoProc
Honored Contributor

Re: uuencode

Harry, when I use that syntax, it just hangs until I send a ctrl-d via the keyboard, and the file I recieved is garbage.

What could I be missing?
We are the people our parents warned us about --Jimmy Buffett
TwoProc
Honored Contributor

Re: uuencode

Disregard previous.
We are the people our parents warned us about --Jimmy Buffett
Steven E. Protter
Exalted Contributor

Re: uuencode

Shalom,

Here is a guide with an internal link that will permit you to do one of two things:

1) Use our working script (sendmail sorry)
2) Fix your code.

http://www.hpux.ws/?p=7

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
Dave La Mar
Honored Contributor

Re: uuencode

Roger-
Attached is an in house doc we use for attachments plus using mailx. I believe Harry's suggestion should have worked, and the -m is an important key as is ux2dos.

Best of luck on this.

Regards,

-dl
"I'm not dumb. I just have a command of thoroughly useless information."