How to send attached files on sendmail with mail tool?

Murray Taylor murraytaylor at bytecraftsystems.com
Thu Jul 22 23:08:09 PDT 2004


man uuencode

uuencode [-m] [-o output_file] [file] name

he uuencode utility reads file (or by default the standard input) and
writes an encoded version to the standard output, or output_file if one
has been specified.  The encoding uses only printing ASCII characters
and includes the mode of the file and the operand name for use by
uudecode.

This works with winblows  - I use it in production here

cat file | uuencode tgt_filname | mail -s "subject" test at example.com
      ^                 ^
      |                 +--- attachment FILENAME for the target host to
use
      +--- attachment CONTENT from the source host


the input file is via stdin to uuencode - this becomes the CONTENT of
the attachment
the File name given to the ATTACHMENT is the tgt_filename 

The result is an email with only on thing inside it - the attachment.


On Fri, 2004-07-23 at 15:57, Jay Moore wrote:

> On Wednesday 21 July 2004 02:10 am, Wojciech Puchar wrote:
> > > > cat file | uuencode tgt_filname | mail -s "subject" test at example.com
> >
> > uuencode <tgt_filname | mail -s "subject" test at example.com
> >
> > instead of cat. less one unneeded piping.
> >
> > > > subject can be derived from shell script variables if necessary.
> > >
> > > Do you have to do a uudecode on the receiving end to recover the file?
> > >
> > > I tried this - sending a pdf file from this FreeBSD system to a Windoze
> > > user that gets mail via POP - it didn't work. The filename came through,
> > > and it was listed as an attachment, but there was nothing useful in the
> > > file.
> >
> > i think windoze just can't decode uuencoded attachments right.
> >
> > it only supports base64 right.
> >
> > metamail will be useful, possibly
> >
> > /usr/local/bin/encode-base64 was installed by package p5-MIME-Base64-2.21
> 
> I'm sure you are correct about Windows... I guess the point I was trying to 
> make is that I think Base64 encoding and appropriate MIME headers are 
> required to be placed in the message to make it a "compliant" message. So 
> while this script may work in certain limited situations, it's probably not a 
> good "general purpose" solution.
> 
> Jay
> 
> ****************************************************************
> This Email has been scanned for Viruses by MailMarshal.
> ****************************************************************

-- 
Murray Taylor
Special Projects Engineer
---------------------------------
Bytecraft Systems & Entertainment
P: +61 3 8710 2555
F: +61 3 8710 2599
D: +61 3 9238 4275
M: +61 417 319 256
E: murraytaylor at bytecraftsystems.com
or visit us on the web
http://www.bytecraftsystems.com
http://www.bytecraftentertainment.com


---------------------------------------------------------------
The information transmitted in this e-mail is for the exclusive
use of the intended addressee and may contain confidential
and/or privileged material. Any review, re-transmission,
dissemination or other use of it, or the taking of any action
in reliance upon this information by persons and/or entities
other than the intended recipient is prohibited. If you
received this in error, please inform the sender and/or
addressee immediately and delete the material. 

E-mails may not be secure, may contain computer viruses and
may be corrupted in transmission. Please carefully check this
e-mail (and any attachment) accordingly. No warranties are
given and no liability is accepted for any loss or damage
caused by such matters.
---------------------------------------------------------------

****************************************************************
This Email has been scanned for Viruses by MailMarshal.
****************************************************************


More information about the freebsd-questions mailing list