Re: How to just view the email constructed by mutt without sending it?

2016-04-20 Thread cs

On 20Apr2016 14:39, Peng Yu  wrote:

Hi, I use the following command to send email with mutt. But
sometimes, I want to inspect the email body constructed by mutt. Is
there a way to do so? Thanks.

echo "This is the message body" | mutt -s "subject of message" --
a...@domain.com


You could set $sendmail to be a script that just took a copy of the message and 
did not send it. Then look at the copy. You can also resent such a copy later 
by handing it directly to sendmail (or whatever your mutt is currently using), 
or by handing it to mutt again with the -H option.


Cheers,
Cameron Simpson 


How to just view the email constructed by mutt without sending it?

2016-04-20 Thread Peng Yu
Hi, I use the following command to send email with mutt. But
sometimes, I want to inspect the email body constructed by mutt. Is
there a way to do so? Thanks.

echo "This is the message body" | mutt -s "subject of message" --
a...@domain.com

-- 
Regards,
Peng


Re: Show output (and place for extra input) from sendmail command

2016-04-20 Thread cs

Oh yes, you will want to pass any arguments received on to your inner script:

 xterm -e script-to-ask-questions-and-then-send.sh "$tmpf" ${1+"$@"}

Cheers,
Cameron Simpson 

On 20Apr2016 20:03, Cameron Simpson  wrote:

On 19Apr2016 20:30, Xu Wang  wrote:

I use a custom sendmail command. I would like to have my script (that
I set to 'sendmail' muttrc variable) ask some questions from to the
user and also give feedback to the user directly. But mutt does not
run the process in the foreground so it seems impossible.

Is there an approach?


Could it pop up a separate terminal window to run the commands? For 
example, untested, make your $sendmail setting point at a shell script 
like this:


#!/bin/sh
set -ue
tmpf=${TMPDIR:-/tmp}/sendmail.$$
cat >"$tmpf"
xterm -e script-to-ask-questions-and-then-send.sh "$tmpf"
rm "$tmpf"

You see we pass in the temp file to your ask-questions-and-send script 
so it can feed the message to sendmail (or whatever), and then remove 
it after xterm returns (which will be after your innner script has 
finished).


Just one idea.

Cheers,
Cameron Simpson 


--


Re: Show output (and place for extra input) from sendmail command

2016-04-20 Thread cs

On 19Apr2016 20:30, Xu Wang  wrote:

I use a custom sendmail command. I would like to have my script (that
I set to 'sendmail' muttrc variable) ask some questions from to the
user and also give feedback to the user directly. But mutt does not
run the process in the foreground so it seems impossible.

Is there an approach?


Could it pop up a separate terminal window to run the commands? For example, 
untested, make your $sendmail setting point at a shell script like this:


 #!/bin/sh
 set -ue
 tmpf=${TMPDIR:-/tmp}/sendmail.$$
 cat >"$tmpf"
 xterm -e script-to-ask-questions-and-then-send.sh "$tmpf"
 rm "$tmpf"

You see we pass in the temp file to your ask-questions-and-send script so it 
can feed the message to sendmail (or whatever), and then remove it after xterm 
returns (which will be after your innner script has finished).


Just one idea.

Cheers,
Cameron Simpson