Re: mailing a stream as a file

2000-11-06 Thread David Champion

On 2000.11.04, in [EMAIL PROTECTED],
"Eric Smith" [EMAIL PROTECTED] wrote:
 Hi
 
 This "works"
 zip - *txt|mutt -s'send a zip file of all txt docs' eric -a -

Odd; it doesn't work for me.  The syntax you give fails to send to the
users "-a" or "-".  Putting "eric" after all options (as I would expect
to be necessary) fails to attach "-".

 on 'V' in mutt received mail gives:
 -   I 1 no description [text/plain, quoted,
 iso-8859-1, 96K]
  A 2 - [text/plain, 7bit,
 us-ascii, 0K]
 
 With the top one being a legal zip file - only problem is that you
 have to name the file when saving it, cause it is nameless.  Also the
 encoding says test/plain but when you save the attachemnt, you get a
 legal zip file.
 
 Is there a way to force a file name? this will also help mutt to state
 the encoding correctly.

I expect that you can use "-e push 'keystrokes'" to push the keystrokes
or symbols for changing the attachment's name and file type, but I
can't test that hypothesis -- see above.

-- 
 -D.[EMAIL PROTECTED]NSITUniversity of Chicago



Re: mailing a stream as a file

2000-11-05 Thread Dirk Ruediger

Hi all!

On Sat, 04 Nov 2000, Eric Smith wrote:

 This "works"
 zip - *txt|mutt -s'send a zip file of all txt docs' eric -a -
 
 on 'V' in mutt received mail gives:
 -   I 1 no description [text/plain, quoted,
 iso-8859-1, 96K]
  A 2 - [text/plain, 7bit,
 us-ascii, 0K]
 
 With the top one being a legal zip file - only problem is that you
 have to name the file when saving it, cause it is nameless.  Also the
 encoding says test/plain but when you save the attachemnt, you get a
 legal zip file.
 
 Is there a way to force a file name? this will also help mutt to state
 the encoding correctly.

On bash and ksh (maybe also other shells) you could use process
substitution (cmd)

# mutt -s'send a zip file of all txt docs' eric -a ( zip - *txt) /dev/null
   ^^
   cmd-subst  ^
  mailbody
The result is:
 1 no description   [text/plain, 7bit, 0K] 
 2 63 [applica/octet-stre, base64, 0.1K]

But it has some limitations:
  - mutt doesn't care about the stream's file type, it's
application/oct-stream
  - the filename is not defined (63 on my box, but maybe it varies
depending on OS)

You should create an temp file (e.g. /tmp/archive.zip) and append it.

Ciao for now, Dirk
-- 
Dirk Ruediger, Rostock, Germany
 
Always borrow money from a pessimist; he doesn't expect to be paid back.



mailing a stream as a file

2000-11-04 Thread Eric Smith

Hi

This "works"
zip - *txt|mutt -s'send a zip file of all txt docs' eric -a -

on 'V' in mutt received mail gives:
-   I 1 no description [text/plain, quoted,
iso-8859-1, 96K]
 A 2 - [text/plain, 7bit,
us-ascii, 0K]

With the top one being a legal zip file - only problem is that you
have to name the file when saving it, cause it is nameless.  Also the
encoding says test/plain but when you save the attachemnt, you get a
legal zip file.

Is there a way to force a file name? this will also help mutt to state
the encoding correctly.


-- 
Eric Smith



Re: mailing a stream as a file

2000-11-04 Thread Mikko Hänninen

Eric Smith [EMAIL PROTECTED] wrote on Sat, 04 Nov 2000:
 This "works"
 zip - *txt|mutt -s'send a zip file of all txt docs' eric -a -

I would recommend saving the stream into a file first, and then
attaching it to the mail with -a.  The body of the message can be
done with redirect from /dev/null, or possibly echo.

If you absolutely need to use a direct stream, then I recommend you
use uuencode to encode the included file.  You can specify the filename
too with uuencode.


Regards,
Mikko
-- 
// Mikko Hänninen, aka. Wizzu  //  [EMAIL PROTECTED]  //  http://www.iki.fi/wiz/
// The Corrs list maintainer  //   net.freak  //   DALnet IRC operator /
// Interests: roleplaying, Linux, the Net, fantasy  scifi, the Corrs /
"Subtle mind control? Why do all these HTML buttons say 'Submit'?"  -- /.



mailing output stream as a file [borderline off topic]

1999-04-16 Thread Eric Smith

Hi

Forgive me if I should address this elsewhere, but the quality of this list
is so high, its just too difficult to resist - ok, I'll stop.

I want to send the output of a unix process (i.e. a text stream) by mail as
an attached text file _non_ interactively. I loathe making tmp files and
then deleting them and would like to keep this all in memory using
variables.

Is there perhaps a way to spoof a text file and get mutt to attach with
`-a' the stream and call the stream filename.txt - or should I just stop
dreaming?

Also I often have difficulty going:
echo this and that other|mutt -s "A Subject" -a attachment.tar.gz joe

Mutt comes upo interactively - if I try from another Account it works fine
- what should I toggle in my muttrc?

Thanx for your help


-- 
Eric Smith
[EMAIL PROTECTED] 
Tel. 021 236 111



Re: mailing output stream as a file [borderline off topic]

1999-04-16 Thread Anonymous

On Fri, Apr 16, 1999 at 11:36:55AM +0200, Eric Smith wrote:

 I want to send the output of a unix process (i.e. a text stream) by mail as
 an attached text file _non_ interactively. I loathe making tmp files and
 then deleting them and would like to keep this all in memory using
 variables.
 
 Is there perhaps a way to spoof a text file and get mutt to attach with
 `-a' the stream and call the stream filename.txt - or should I just stop
 dreaming?

There is a way, though it's a bit odd.  The trick is to make a FIFO (a la
"named pipe").  Try something like this:

mkfifo text.txt
echo "blah blah blah" | mutt -a text.txt myself@localhost

Now mutt will block waiting for data to appear on text.txt.  You need to
write the data you have into the text.txt pipe.

echo "foo"  text.txt  (I know you mentioned you wanted to do this
under program control, but this is just an
example)

Now you need to do it twice more as mutt seems to read an attached file
three times:

echo "foo"  text.txt
echo "foo"  text.txt

Voila.

I'm sure if you looked at the code you could figure out what mutt is
reading the file three times for and perhaps avoid having to send the
whole thing three times.

David

-- 
   David Shaw  |  [EMAIL PROTECTED]  |  WWW http://www.jabberwocky.com/
+---+
   "There are two major products that come out of Berkeley: LSD and UNIX.
  We don't believe this to be a coincidence." - Jeremy S. Anderson



Re: mailing output stream as a file [borderline off topic]

1999-04-16 Thread David DeSimone

David Shaw [EMAIL PROTECTED] wrote:

 There is a way, though it's a bit odd.  The trick is to make a FIFO (a la
 "named pipe").

That works, but it doesn't meet the stated requirements, because you'd
have to remember to delete the file that was created.  He said he was
trying not to have to do that (though it doesn't seem that hard to
me...).  :)

The biggest problem that I see is that Mutt uses the name of the file to
determine the MIME type of the attachment.  Without a filename, Mutt
won't know what type to assign the attachment.  Using a named pipe is a
nice trick to give the attachment a filename, but having to write the
pipe several times in order to meet Mutt's habit of re-reading it
several times is just a bit too weird; seems like it's easier to just go
ahead and write the file, call Mutt, and then delete it.

-- 
David DeSimone   | "The doctrine of human equality reposes on this:
[EMAIL PROTECTED]   |  that there is no man really clever who has not
Hewlett-Packard  |  found that he is stupid." -- Gilbert K. Chesterson
Convex Division  |PGP: 5B 47 34 9F 3B 9A B0 0D  AB A6 15 F1 BB BE 8C 44



Re: mailing output stream as a file [borderline off topic]

1999-04-16 Thread David Shaw

On Fri, Apr 16, 1999 at 12:54:34PM -0500, David DeSimone wrote:
 David Shaw [EMAIL PROTECTED] wrote:
 
  There is a way, though it's a bit odd.  The trick is to make a FIFO (a la
  "named pipe").
 
 That works, but it doesn't meet the stated requirements, because you'd
 have to remember to delete the file that was created.  He said he was
 trying not to have to do that (though it doesn't seem that hard to
 me...).  :)

He didn't want a temporary file for each attachment.  One FIFO can be all
of his attachments, so he doesn't have to delete it.  It uses no space on
the disk (aside from the housekeeping information) and may as well just
sit around.

 The biggest problem that I see is that Mutt uses the name of the file to
 determine the MIME type of the attachment.  Without a filename, Mutt
 won't know what type to assign the attachment.  Using a named pipe is a
 nice trick to give the attachment a filename, but having to write the
 pipe several times in order to meet Mutt's habit of re-reading it
 several times is just a bit too weird; seems like it's easier to just go
 ahead and write the file, call Mutt, and then delete it.

That's what I'd do too, but he didn't want a temporary file.

David

-- 
   David Shaw  |  [EMAIL PROTECTED]  |  WWW http://www.jabberwocky.com/
+---+
   "There are two major products that come out of Berkeley: LSD and UNIX.
  We don't believe this to be a coincidence." - Jeremy S. Anderson