[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Attaching a file with "mail"



* Carl Fink (carl@fink.to) [030423 08:17]:
> On Wed, Apr 23, 2003 at 07:13:02AM -0300, Fernando Shayani wrote:
> 
> > Is there any way to attach a file to the command mail?
> > I need to automatic send a e-mail with a file attached to it.
> > 
> > Ex: mail fernando@shayani.net -s "My subject" ATTACH.TAR
> 
> Not with that syntax, no.  You could mime encode the file using "mimencode",
> then do something like:
> 
> 	cat myencodedfile.txt | mail mail joe@blow.com -s "Subject"
> 
> (I haven't tried this.)
> 
> The answers using mutt and others are of course right, but it is possible to
> do it with mail (and a script).

Right; a more precise answer is that mailx _cannot_ do this.  It doesn't
know mime, nor uuencode.  You can, of course, use the external utilities
to manually mime- or uu- encode a file, and then give that to mailx to
send off.  This is the typical unix way of doing things: you string
together lots of very specific tools to accomplish larger tasks.

good times,
Vineet
-- 
http://www.doorstop.net/
-- 
"Extremism in the defense of liberty is no vice.
Moderation in the pursuit of justice is no virtue."  -- Barry Goldwater 

Attachment: pgpslqXfCByaA.pgp
Description: PGP signature


Reply to: