I'd thought he could put the data into a file and then
invoke mutt, something like.

<pre-amble creating body of email>

mutt -s $subject_string $delivery_to_string < message_file

At least this works for me when using mailx, but that is a
very different utility than mutt.



On Tue, Apr 17, 2012 at 11:24:10AM -0500, Luis Mochan wrote:
> On Tue, Apr 17, 2012 at 01:10:43PM -0300, Andrei Mikhailov wrote:
> > Thank you !
> > I think I now understand, more or less, why it does not work as expected.
> > Perhaps my question is more about Linux, than about Mutt. What I really
> > want to achieve is the following:
> > 
> >   echo "mydata" | myscript.sh
> > 
> > where myscript.sh is the following:
> > 
> >   #!/bin/bash
> >   some-program-which-reads-from-stdin.sh
> >   mutt
> If your purpose is automatically sending mail based on 'mydata' and
> the results of some-program..., maybe you shouldn't use mutt, which I
> believe is designed for interactive use. For example, in my perl
> scripts I use Mime::Lite to send email as
> 
>     my $msg=MIME::Lite->new(
>       From=>'My Name <my@address>',
>       To=>'Her name <her@address>',
>       Subject=>"My subject",
>       Type=>'text/plain; charset=utf-8',
>       Data=>"The message text with interpolated $variables",
>     );
>     $msg->attach(
>       Type=>'text/plain;charset=utf8',
>       Path=>'aTextFile.txt',
>       Disposition=>'inline'
>       );
>     $msg->attach(
>       Type=>'image/jpg',
>       Path=>'anImageFile.jpg',
>       Disposition=>'attachment'
>       );
>    $msg->send;
> 
> Best regards,
> Luis
> 
> > 
> > In other words, the script first reads the pipe and does something, 
> > and then just calls mutt.
> > Somehow, beteween ``some-program-...'' and ``mutt'' I have to insert
> > some command, saying:
> >   ``finished reading pipe, control is now returning to the terminal''
> > Is that possible?
> > Is it possible to call Mutt from within scripts accepting pipe input?
> > 
> > On Tue, Apr 17, 2012 at 10:37:55AM -0500, Derek Martin wrote:
> > > On Tue, Apr 17, 2012 at 11:46:15AM -0300, Andrei Mikhailov wrote:
> > > > I would expect that this command:
> > > > 
> > > >   echo mymaildir | xargs mutt -f 
> > > > 
> > > > be equivalent to:
> > > > 
> > > >   mutt -f mymaildir
> > > > 
> > > > But instead, mutt complains about ``no recipient specified''.
> > > > Please help me to figure this out!
> > > 
> > > The problem here is that when you run it this way, Mutt's stdin is not
> > > a terminal.  When that's the case, mutt expects you're composing a
> > > message on the command line, and will complain when you don't provide
> > > it enough options to specify the message envelope:
> > > 
> > > $ mutt -f Mailbox < /dev/null
> > > No recipients were specified.
> > > 
> > > For the UI to work, stdin must be a terminal, so that mutt (or rather,
> > > whichever terminal control library it uses) knows what to send to the
> > > terminal to draw the screen, etc.  AFAIK there's no way around that.
> > > 
> > > -- 
> > > Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
> > > -=-=-=-=-
> > > This message is posted from an invalid address.  Replying to it will 
> > > result in
> > > undeliverable mail due to spam prevention.  Sorry for the inconvenience.
> > > 
> > 
> > 
> 
> -- 
> 
>                                                                   o
> W. Luis Moch?n,                      | tel:(52)(777)329-1734     /<(*)
> Instituto de Ciencias F?sicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
> Apdo. Postal 48-3, 62251             |                           (*)/\/  \
> Cuernavaca, Morelos, M?xico          | moc...@fis.unam.mx   /\_/\__/
> 
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org               
>   
> 
> 
---
   Brian R Cuttler                 brian.cutt...@wadsworth.org
   Computer Systems Support        (v) 518 486-1697
   Wadsworth Center                (f) 518 473-6384
   NYS Department of Health        Help Desk 518 473-0773



IMPORTANT NOTICE: This e-mail and any attachments may contain
confidential or sensitive information which is, or may be, legally
privileged or otherwise protected by law from further disclosure.  It
is intended only for the addressee.  If you received this in error or
from someone who was not authorized to send it to you, please do not
distribute, copy or use it or any attachments.  Please notify the
sender immediately by reply e-mail and delete this from your
system. Thank you for your cooperation.


Reply via email to