Discussion:
sendmail-program with msmtpq
Xavier Maillard
2018-11-11 22:00:36 UTC
Permalink
Hello,

I am trying to use msmtpQ with the regular mail-mode.
I set sendmail-program to "msmtpq" and `send-mail-function' to `sendmail-send-it'.

My goal with this setup is to queue my outgoing messages when I am not
connected. There is something wrong at some point; when unplugged,
msmtpq is doing the right thing: it queues the outgoing message but `sendmail-send-it' would consider it as unsent.

Here is the log:

[2018-11-10 08:12:02.017] Sending...
Added to /home/xavier/.cache/mail/sent
sendmail-send-it: Sending...failed to mail for [ -oi -f ***@maillard.im -oep -odi -t ] : couldn't be sent - host not connected; enqueued mail as : [ 2018-11-10-08.12.02 ] ( -oi -f ***@maillard.im -oep -odi -t ) : successful;

Due to that behaviour, calling C-x m again is just asking if I want to erase the *mail* buffer instead of creating a new one.

What's wrong ?

Regards
--
Xavier
Eli Zaretskii
2018-11-12 03:41:04 UTC
Permalink
Date: Sun, 11 Nov 2018 23:00:36 +0100
My goal with this setup is to queue my outgoing messages when I am not
connected. There is something wrong at some point; when unplugged,
msmtpq is doing the right thing: it queues the outgoing message but `sendmail-send-it' would consider it as unsent.
[2018-11-10 08:12:02.017] Sending...
Added to /home/xavier/.cache/mail/sent
Due to that behaviour, calling C-x m again is just asking if I want to erase the *mail* buffer instead of creating a new one.
What's wrong ?
I suspect that your program exits with non-zero exit status in this
case, but I cannot be sure because you don't seem to show the entire
message.

sendmail-send-it expects a successful sending to exit with zero
status.
Xavier Maillard
2018-11-12 05:11:53 UTC
Permalink
Hello Eli,
Date: Mon, 12 Nov 2018 05:41:04 +0200
Date: Sun, 11 Nov 2018 23:00:36 +0100
My goal with this setup is to queue my outgoing messages when I am not
connected. There is something wrong at some point; when unplugged,
msmtpq is doing the right thing: it queues the outgoing message but `sendmail-send-it' would consider it as unsent.
[2018-11-10 08:12:02.017] Sending...
Added to /home/xavier/.cache/mail/sent
Due to that behaviour, calling C-x m again is just asking if I want to erase the *mail* buffer instead of creating a new one.
What's wrong ?
I suspect that your program exits with non-zero exit status in this
case, but I cannot be sure because you don't seem to show the entire
message.
Here is a test from the command line:

# With connection ON
$ cat /tmp/test-mail | ~/bin/msmtpq ***@maillard.im
mail for [ ***@maillard.im ] : send was successful

$ echo $?
0

# With connection OFF
$ cat /tmp/test-mail | ~/bin/msmtpq ***@maillard.im
mail for [ ***@maillard.im ] : couldn't be sent - host not connected
enqueued mail as : [ 2018-11-12-06.05.45 ] ( ***@maillard.im ) : successful

$ echo $?
0
sendmail-send-it expects a successful sending to exit with zero
status.
As far as I can see, it should be ok. Does sendmail-send-it expect a message or something like that ?

Thank you.
--
Xavier
Xavier Maillard
2018-11-12 05:22:54 UTC
Permalink
Hello again,

in fact, no matter my online status, calling `compose-mail' after a
previous call to `sendmail-send-it' behaves the same.

I did not pay attention before but, I have many `sendmail-errors-XXXX'
buffers with msmtpqs's output (exactly the same output than when
calling it from the terminal).

Is it safe to "silent" msmtpq via an advice in the `sendmail-send-it'
function ?

--
Xavier
Eli Zaretskii
2018-11-12 15:44:05 UTC
Permalink
Date: Mon, 12 Nov 2018 06:22:54 +0100
in fact, no matter my online status, calling `compose-mail' after a
previous call to `sendmail-send-it' behaves the same.
I did not pay attention before but, I have many `sendmail-errors-XXXX'
buffers with msmtpqs's output (exactly the same output than when
calling it from the terminal).
Please show the full message you get in the *Messages* buffer after a
failure to send a message.
Is it safe to "silent" msmtpq via an advice in the `sendmail-send-it'
function ?
Sorry, I don't understand what that means, nor how it is related to
the issue at hand. What do you mean by "silent"? if you mean
"silence", I still don't see where did you silence it and why do you
think it might be unsafe to do that.
Xavier Maillard
2018-11-12 20:54:05 UTC
Permalink
Date: Mon, 12 Nov 2018 17:44:05 +0200
Date: Mon, 12 Nov 2018 06:22:54 +0100
in fact, no matter my online status, calling `compose-mail' after a
previous call to `sendmail-send-it' behaves the same.
I did not pay attention before but, I have many `sendmail-errors-XXXX'
buffers with msmtpqs's output (exactly the same output than when
calling it from the terminal).
Please show the full message you get in the *Messages* buffer after a
failure to send a message.
In fact, there is no failure just an output from the msmtpq command
which I suspect, is not what is expected.

I read through msmtpq source code (thank you FOSS) and I find a way to
make the command be quiet.

I tested it and it no longer bails out any error anywhere (and my
mesages are either sent or queued depending my connectivity).

Thank you for your help.

--
Xavier
Eric Abrahamsen
2018-11-12 23:10:01 UTC
Permalink
Post by Xavier Maillard
Date: Mon, 12 Nov 2018 17:44:05 +0200
Date: Mon, 12 Nov 2018 06:22:54 +0100
in fact, no matter my online status, calling `compose-mail' after a
previous call to `sendmail-send-it' behaves the same.
I did not pay attention before but, I have many `sendmail-errors-XXXX'
buffers with msmtpqs's output (exactly the same output than when
calling it from the terminal).
Please show the full message you get in the *Messages* buffer after a
failure to send a message.
In fact, there is no failure just an output from the msmtpq command
which I suspect, is not what is expected.
I read through msmtpq source code (thank you FOSS) and I find a way to
make the command be quiet.
I tested it and it no longer bails out any error anywhere (and my
mesages are either sent or queued depending my connectivity).
As an interested bystander: did you suppress the error, or did you
change the return value so it didn't return a message (only the 0)? My
understanding is that msmtpq should return 0 whether it sent the message
or queued it, right? Can't `call-process-region' ignore the message, and
only pay attention to the return value?

Loading...