Re: How can I know if error happens when sending mail?

2009-06-03 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On Wednesday, June  3 at 05:20 PM, quoth Chengqi(Lars) Song:
-code
lars:~$ less .bin/msmtp-wrap
#! /bin/bash

msmtp $*
if [ $? != 0 ]
then
  gxmessage -wrap -fg red -bg black -default okay -center MSMTP: `tail -1 
 ~/.getmail/msmtp.log`
fi
--

I have a few minor suggestions.

First, you probably don't want to use $*, but you probably want to use 
$@ instead, to preserve any arguments that might have spaces in 
them.

Secondly, you don't have to use the $? variable, you can simply do 
this:

 #!/bin/bash

 if ! msmtp $@ ; then
 gxmessage -wrap -fg red -bg black -default okay -center \
 MSMTP: `tail -1 ~/.getmail/msmtp.log`
 fi

~Kyle
- -- 
No nation is permitted to live in ignorance with impunity.
-- Thomas Jefferson
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iQIcBAEBCAAGBQJKJpNwAAoJECuveozR/AWe81oP/iZrn4ytub1+DXDtAhM93jLh
ZWOEK2wNZpAOSscM+C3VjwlnQaQHPRCpYHBIVTZz8I0QUqZaKOYoNMMfCP03r5Ao
DAb3tShzoFkB9mXYCepzPdrI6sbyozdj/gkRGDyZjEe9MzDVp6KJo3iuYJXbP4Q4
UNN533HoiI/mXLNxV2x5NVFmqCn8t+kwdV2WqM0Le0+IDgVpVom0F0ZNu2F8dKAY
ncizdYFsBeVjgBuDVjzo6X6OD+uPGyYNZzW6UpiSL9iqEmkrJ40pa0fjC5uv3VvV
SRyh8vfdkGXjMfF4iASnDUxXMBpdLCAVw1F3kn9nviudauyVbor2ythDY8armrNG
v4wtb+TF5FhYaLUC95UpCdUSNX5Q+I+OUmq5UtyLHTx612vw0W9ZsfTci/7+du4t
lHgujaHElAIy2SGMyp6PP1KoSrLp+znTVJBAvW5hv8pV/J0PfaRbV8UZwPNwdWHU
Q3/TsKuApwxi9jPoWTAdyKyd1cYy7aJhpHvSrM2WELURuzQmwyNNpVFgKjB50iWz
RPiFhknBZXvvrPWEmBAQS2XJbjmwGNIak4queg601UsIn+Trgot9gt94hbSFtdlU
DlUWlzUazN7FA4MgYjdZUSd8DXwGUVUR428pFlSF1/ccYkblZp1Z2UXeA59KpdPc
ZDFrJ/3aihKnkX7CBt4h
=Q2YN
-END PGP SIGNATURE-


Re: How can I know if error happens when sending mail?

2009-06-03 Thread Chengqi(Lars) Song
thanks, your suggestion is applied :)
On Wed, 03 Jun 2009, Kyle Wheeler wrote:

 On Wednesday, June  3 at 05:20 PM, quoth Chengqi(Lars) Song:
 -code
 lars:~$ less .bin/msmtp-wrap
 #! /bin/bash
 
 msmtp $*
 if [ $? != 0 ]
 then
   gxmessage -wrap -fg red -bg black -default okay -center MSMTP: `tail -1 
  ~/.getmail/msmtp.log`
 fi
 --
 
 I have a few minor suggestions.
 
 First, you probably don't want to use $*, but you probably want to use 
 $@ instead, to preserve any arguments that might have spaces in 
 them.
 
 Secondly, you don't have to use the $? variable, you can simply do 
 this:
 
  #!/bin/bash
 
  if ! msmtp $@ ; then
  gxmessage -wrap -fg red -bg black -default okay -center \
  MSMTP: `tail -1 ~/.getmail/msmtp.log`
  fi
 
 ~Kyle
 -- 
 No nation is permitted to live in ignorance with impunity.
 -- Thomas Jefferson


Re: How can I know if error happens when sending mail?

2009-06-02 Thread JP Bruns

Kyle [02.Jun.2009 04:42]:


On Tuesday, June  2 at 10:09 AM, quoth Chengqi(Lars) Song:

indeed can not interrupt mutt, but can send a local mail to myself instead i 
think ...


Actually, now that I think about it... you might be able to use 
xdialog (or something similar) to display an alert message, rather 
than send another email.


Is there anything for console-only systems? Mutt is a great piece of software, 
but - in my eyes - is lacking this important feature. Would it be possible to 
take the return-code/-message of the *smtp program and display that on the 
status-line (or the message(?)-line)? What about creating a mail-reply to that 
message on its own with the sending-error as body and mark that as new mail?

How do other people deal with this issue?


JP


Re: How can I know if error happens when sending mail?

2009-06-02 Thread Nicolas Rachinsky
* JP Bruns emailj...@gmx.de [2009-06-02 10:37 +0200]:
 Is there anything for console-only systems? Mutt is a great piece of 
 software, but - in my eyes - is lacking this important feature. Would it be 
 possible to take the return-code/-message of the *smtp program and display 
 that on the status-line (or the message(?)-line)? What about creating a 
 mail-reply to that message on its own with the sending-error as body and mark 
 that as new mail?

Please wrap your lines.

The manual says about sendmail_wait:
   Note that if you specify a value other than 0, the output of the child
   process will be put in a temporary file. If there is some error, you
   will be informed as to where to find the output.

So it seems, the feature you want is already there.

Nicolas
-- 
http://www.rachinsky.de/nicolas


Re: How can I know if error happens when sending mail?

2009-06-02 Thread Chengqi(Lars) Song
yeah, the manual says we will be informed, but in fact i tested and didnt see 
any information about
the error.

lars

On Tue, 02 Jun 2009, Nicolas Rachinsky wrote:

 * JP Bruns emailj...@gmx.de [2009-06-02 10:37 +0200]:  Is there anything 
 for console-only
 systems? Mutt is a great piece of software, but - in my eyes - is lacking 
 this important
 feature. Would it be possible to take the return-code/-message of the *smtp 
 program and display
 that on the status-line (or the message(?)-line)? What about creating a 
 mail-reply to that message
 on its own with the sending-error as body and mark that as new mail?  

Please wrap your lines.  The manual says about sendmail_wait: Note that if you 
specify a value other
than 0, the output of the child process will be put in a temporary file. If 
there is some error, you
will be informed as to where to find the output.  So it seems, the feature you 
want is already
there.  Nicolas -- http://www.rachinsky.de/nicolas


Re: How can I know if error happens when sending mail?

2009-06-02 Thread JP Bruns

Nicolas [02.Jun.2009 16:09]:


* JP Bruns emailj...@gmx.de [2009-06-02 10:37 +0200]:

Is there anything for console-only systems? Mutt is a great piece of software, 
but - in my eyes - is lacking this important feature. Would it be possible to 
take the return-code/-message of the *smtp program and display that on the 
status-line (or the message(?)-line)? What about creating a mail-reply to that 
message on its own with the sending-error as body and mark that as new mail?


Please wrap your lines.


Oh, I am sorry, I forgot to change it back after sending some
config-files some time ago. Mutt was still wrapping it for me, so I
didn't think about it :( My bad.


The manual says about sendmail_wait:
  Note that if you specify a value other than 0, the output of the child
  process will be put in a temporary file. If there is some error, you
  will be informed as to where to find the output.


That is strange because I have it set to -1 and do not see any message
as to where the output is. Might it be that this messages is only shown
for a short time or that it will be clicked away while I continue using
mutt? I will try changing it to a positive value, waiting one second is
still acceptable compared to the time a 3MB email takes.


JP


How can I know if error happens when sending mail?

2009-06-01 Thread Chengqi(Lars) Song
Hi,

I'm using msmtp to send mail. I've set sendmail_wait=-1 in .muttrc to make 
sending mail not blocking. But there comes a problem. If any error happens when 
sending mail, I will not aware about it. And sometimes it cause trouble to my 
work. How can I solve this problem? I need to be told if error happens in 
sending mail. 

Thanks
Lars


Re: How can I know if error happens when sending mail?

2009-06-01 Thread Markus Maria Miedaner

 Hi,
 
 I'm using msmtp to send mail. I've set sendmail_wait=-1 in .muttrc to make 
 sending mail not blocking. But there comes a problem. If any error happens 
 when sending mail, I will not aware about it. And sometimes it cause trouble 
 to my work. How can I solve this problem? I need to be told if error happens 
 in sending mail. 
 
 Thanks
 Lars
 
Ciao Lars,

you can specify a log_file for msmtp by adding the following to each 
account_setting in your .msmtprc

logfile ~/msmtp.log

all you need to do then is to watch the file after sending an email. it may 
take a few seconds before the logentries are written for each mail.
for notification you could add a logwatcher to automate this process.

cheers,
markus

___
Nur bis 31.05.: WEB.DE FreeDSL Komplettanschluss mit DSL 6.000 Flatrate
und Telefonanschluss für 17,95 Euro/mtl.! http://produkte.web.de/go/02/



smime.p7s
Description: S/MIME Cryptographic Signature


Re: How can I know if error happens when sending mail?

2009-06-01 Thread Chengqi(Lars) Song
Hi Markus,

Thanks for the method you provided. In fact I thought of that too. But still 
it's not efficient to watch that log file everytime after sending a mail. 
Logwatch should work but still I wonder if there is any easier way to do this 
job. Could we possible wrap msmtp in a shell script, and in the script call 
pass all parameters to msmtp and watch consequential results? Have anybody done 
that?

Thanks
Lars

On Mon, 01 Jun 2009, Markus Maria Miedaner wrote:

 
  Hi,
  
  I'm using msmtp to send mail. I've set sendmail_wait=-1 in .muttrc to make 
  sending mail not blocking. But there comes a problem. If any error happens 
  when sending mail, I will not aware about it. And sometimes it cause 
  trouble to my work. How can I solve this problem? I need to be told if 
  error happens in sending mail. 
  
  Thanks
  Lars
  
 Ciao Lars,
 
 you can specify a log_file for msmtp by adding the following to each 
 account_setting in your .msmtprc
 
 logfile ~/msmtp.log
 
 all you need to do then is to watch the file after sending an email. it may 
 take a few seconds before the logentries are written for each mail.
 for notification you could add a logwatcher to automate this process.
 
 cheers,
 markus
 
 ___
 Nur bis 31.05.: WEB.DE FreeDSL Komplettanschluss mit DSL 6.000 Flatrate
 und Telefonanschluss f?r 17,95 Euro/mtl.! http://produkte.web.de/go/02/
 



- End forwarded message -


Re: How can I know if error happens when sending mail?

2009-06-01 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On Tuesday, June  2 at 12:08 AM, quoth Chengqi(Lars) Song:
 Thanks for the method you provided. In fact I thought of that too. 
 But still it's not efficient to watch that log file everytime after 
 sending a mail. Logwatch should work but still I wonder if there is 
 any easier way to do this job. Could we possible wrap msmtp in a 
 shell script, and in the script call pass all parameters to msmtp 
 and watch consequential results? Have anybody done that?

Sure, you could do that, but what then? What should the shell script 
do if sending the message fails? It can't interrupt your mutt 
session...

~Kyle
- -- 
The government of the United States is not in any sense founded on the 
Christian Religion.
   -- US Treaty with Tripoly, 1797
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iQIVAwUBSiQDbCuveozR/AWeAQgFlBAAq4E2F77muy+XnqnwEzCTcJ1UYAGjmV33
S5jT0LYfPLHo2OZs/GGhe9Om9H7gsSaqw4tCN/12TF9vD2AX8kl4p6UekrN8ZgWq
lihZrACoMK2lOsFhbaPxZQfwe3nulKti03U8ojgDjKPUsfajf7Ai9Yjp2EbiNTpN
1aSpvARGlsUXdqfwKjGfKmCV5cqGRVn/eIJ+Lo9FTCfI90TRgAdMmpIsir9QgHmf
9WUbhEUdyAcVCCEE+hcoJT0n3qR2AT8cn4h7WQZQQZb6C+BUQaiBwD+nS6+wBqz/
rqLEzITfcQbuNtsL4jgVJW7rhzP6dEsUonTsJblzjIQmotWGLEyWMH5cpgpuQXXw
8faosqwhQpYqMqT0jZV2Mov181aHmZ450MuLVh+Big7qAq/6hBnu3umM9kjWUzyI
Hs+RZFRh7LVX9qGvVCF1ENBSix+RdbncZEtsalDXT8AbG3a25CJgpFgyyXFtNGeQ
yWA1CNBWfBWSo53Rhle14PPrFRJcrdCwWZWbuampNvDxEW479PPRikZM7XBd5Z1Y
9zMnmymgDTeAV94FD1GHruu4DtdgG6iLIJRISP+ou91L/NArrgU5uaS4xJrDGdcp
4qPGZi8nLfJs+KhsfN551qI19faErDzP1IgxSvI4VyViu20q6s60WySx7aw1zmDs
ob8lOvnEMTA=
=MNds
-END PGP SIGNATURE-


Re: How can I know if error happens when sending mail?

2009-06-01 Thread Chengqi(Lars) Song
indeed can not interrupt mutt, but can send a local mail to myself instead i 
think ...

lars

On Mon, 01 Jun 2009, Kyle Wheeler wrote:

 On Tuesday, June  2 at 12:08 AM, quoth Chengqi(Lars) Song:
  Thanks for the method you provided. In fact I thought of that too. 
  But still it's not efficient to watch that log file everytime after 
  sending a mail. Logwatch should work but still I wonder if there is 
  any easier way to do this job. Could we possible wrap msmtp in a 
  shell script, and in the script call pass all parameters to msmtp 
  and watch consequential results? Have anybody done that?
 
 Sure, you could do that, but what then? What should the shell script 
 do if sending the message fails? It can't interrupt your mutt 
 session...
 
 ~Kyle
 -- 
 The government of the United States is not in any sense founded on the 
 Christian Religion.
-- US Treaty with Tripoly, 1797


Re: How can I know if error happens when sending mail?

2009-06-01 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On Tuesday, June  2 at 10:09 AM, quoth Chengqi(Lars) Song:
indeed can not interrupt mutt, but can send a local mail to myself instead i 
think ...

Actually, now that I think about it... you might be able to use 
xdialog (or something similar) to display an alert message, rather 
than send another email.

~Kyle
- -- 
If I had only known, I would have been a locksmith.
-- Albert Einstein
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iQIVAwUBSiSReiuveozR/AWeAQiHIw//SKb7daI7zOn95WikrVm2zelzvzAlb/A/
xTw2SgxmJvP8xQ833U4NgbY+x7llAuIOZB4NZYRaepgTUvNUG5PRLxzTqr+XG0Aj
sr3jlO+inDsjPPRZzuIdrXBlyndaEU2jGuPQwXUfAo2h7/EwucIhQ295I/lswcE0
SzCjJ/qO1XolDc+B9GvF9rM2g2vaznIA8/CO3kRSYBq7zvA3X/aW3CNwEQpQ50CQ
JMDLSxUv7veYjIwLJuYYXT7Ed9d7KkNBnwlHf9xcLByxmElFyuqbUGYM5mbj3YA7
Y8zgaR+Wu15sx0vjw7PAima9OM+7OJhJzu4kTUx2gLkwlPgVu3ikH+5kgVXyGBUs
flRRcbAvOrX8NfAgnWkp5nlF2OTQloE58gg7MMvjabjqeuwHlmqf7q4hKSQzRz2C
33mHQ9fCArQB1M8Ac2lCs2DRwXQurjk8HOLWTHR9YgApYVoJapwUf+gNklWbvKGc
rFeCpZKz8EmNI6Qx9rg30w+dRSkrBBZoUXyXcejFiJ6S4OZKdHEB+zot4hoHvZmu
ENIKtQSXo5bCQOLZc+7IdOtXI4gtnvg7Uk8CNsnEAV4UVSUR8ypjq/kGpApOhxMe
OvjTvmZHZuJm2eQtu8Agw/zSgDlNzP+31Y8Ort24LlbGRMk9VBheNT484aB+6QtQ
WQmQ4xbTkRA=
=vlFF
-END PGP SIGNATURE-