GNU bug report logs - #68686
[Bug] smtpmail-send-queued-mail ignores some headers of the message it's sending!

Previous Next

Package: emacs;

Reported by: rameiko87 <at> posteo.net

Date: Wed, 24 Jan 2024 12:51:01 UTC

Severity: normal

To reply to this bug, email your comments to 68686 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#68686; Package emacs. (Wed, 24 Jan 2024 12:51:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to rameiko87 <at> posteo.net:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 24 Jan 2024 12:51:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: rameiko87 <at> posteo.net
To: bug-gnu-emacs <at> gnu.org
Subject: [Bug] smtpmail-send-queued-mail ignores some headers of the message
 it's sending!
Date: Wed, 24 Jan 2024 12:50:11 +0000
Disclaimer: I use Rmail on Emacs, and Message-Mode.

Bug Part 1:

The From: header is ignored (from the message as saved in 'queued email 
folder') when sending with smtpmail-send-queued-mail, and takes the 
value of user-mail-address when this wasn't previously customized by the 
user. This is really worrisome! What else is ignored and rewritten 
without warning when invoking smtpmail-send-queued-mail?

Followup to Bug Part 1:

It would be interesting to figure out whether this happens also when 
user-mail-address had been previously customized by the user.

Bug Part 2:

This discrepancy between the behaviour of queued-sending and immediate 
sending (I use the default functions for the most current version of 
Emacs as of today) I consider to be a bug on itself. Because not doing 
things consistently confuses the user (even not doing the *wrong* thing 
consistently confuses the user. In this case the wrong thing is 
rewriting the From: header of every email).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68686; Package emacs. (Wed, 24 Jan 2024 16:03:02 GMT) Full text and rfc822 format available.

Message #8 received at 68686 <at> debbugs.gnu.org (full text, mbox):

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: rameiko87 <at> posteo.net
Cc: 68686 <at> debbugs.gnu.org
Subject: Re: bug#68686: [Bug] smtpmail-send-queued-mail ignores some headers
 of the message it's sending!
Date: Wed, 24 Jan 2024 17:01:22 +0100
rameiko87 <at> posteo.net writes:

> Disclaimer: I use Rmail on Emacs, and Message-Mode.
>
> Bug Part 1:
>
> The From: header is ignored (from the message as saved in 'queued
> email folder') when sending with smtpmail-send-queued-mail, and takes
> the value of user-mail-address when this wasn't previously customized
> by the user. This is really worrisome! What else is ignored and
> rewritten without warning when invoking smtpmail-send-queued-mail?

This is not what I observe.  Like you, I have a one word (without dot)
hostname: "computer".  Then, I do:

   - emacs -Q
   - M-: (setq send-mail-function 'smtpmail-send-it)
   - M-: (setq smtpmail-queue-mail t)
   - M-x message-mail
  [ here the "From:" is set to
    manuel <at> computer.mail-host-address-is-not-set]
   - I fill "To:" and 'C-c C-c'
  [ now another mail… ]
   - M-x message-mail
  [ I fill "To:" and change the "From:" to manuel <at> elsewhere ]
   - 'C-c C-c'
  [ do send now… ]
   - M-x smtpmail-send-queued-mail

Both mails are sent and when I retrieve them both have the "From:"
exactly how it was: respectively
manuel <at> computer.mail-host-address-is-not-set and manuel <at> elsewhere

> Followup to Bug Part 1:
>
> It would be interesting to figure out whether this happens also when
> user-mail-address had been previously customized by the user.
>
> Bug Part 2:
>
> This discrepancy between the behaviour of queued-sending and immediate
> sending (I use the default functions for the most current version of
> Emacs as of today) I consider to be a bug on itself. Because not doing
> things consistently confuses the user (even not doing the *wrong*
> thing consistently confuses the user. In this case the wrong thing is
> rewriting the From: header of every email).

I have tested the same recipe as above (without setting
smtpmail-queue-mail to t) and it works correctly for me and the "From:"
of the two retrieved mails are also the same.  Could you test this
recipe?
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68686; Package emacs. (Wed, 24 Jan 2024 17:26:02 GMT) Full text and rfc822 format available.

Message #11 received at 68686 <at> debbugs.gnu.org (full text, mbox):

From: rameiko87 <at> posteo.net
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: 68686 <at> debbugs.gnu.org
Subject: Re: bug#68686: [Bug] smtpmail-send-queued-mail ignores some headers
 of the message it's sending!
Date: Wed, 24 Jan 2024 17:25:27 +0000
Try the following to reproduce the core of the bug which I'm talking 
about on GNU Emacs 29.1:

Open emacs as follows:
emacs -Q

For each of the following lines, do M-: and then paste the line, press 
enter.

(setq message-mail-user-agent t)  BUT I THINK EVEN IF YOU SKIP THIS, THE 
SAME RESULT OCCURS

(setq send-mail-function 'smtpmail-send-it)

(setq smtpmail-queue-mail t)

(setq smtpmail-smtp-server "INSERT YOUR SMTP SERVER HERE")

(setq smtpmail-smtp-service 465)

(setq smtpmail-stream-type 'ssl)

Now generate a new message:
C-x m

Now fill in the headers To: to one of your addresses, From: to another 
of your addresses (mine have different domain, and the To: is the same 
domain as the smtp server), Subject: test, Body: test

C-c C-s

M-x smtpmail-send-queued-mail

Press enter, and I get the following message:

smtpmail-send-queued-mail: Sending failed: 504 5.5.2 <user <at> fedora>: 
Sender address rejected: need fully-qualified address


>> Bug Part 1:
>> 
>> The From: header is ignored (from the message as saved in 'queued
>> email folder') when sending with smtpmail-send-queued-mail, and takes
>> the value of user-mail-address when this wasn't previously customized
>> by the user. This is really worrisome! What else is ignored and
>> rewritten without warning when invoking smtpmail-send-queued-mail?
>> 
>> Followup to Bug Part 1:
>> 
>> It would be interesting to figure out whether this happens also when
>> user-mail-address had been previously customized by the user.
>> 
>> Bug Part 2:
>> 
>> This discrepancy between the behaviour of queued-sending and immediate
>> sending (I use the default functions for the most current version of
>> Emacs as of today) I consider to be a bug on itself. Because not doing
>> things consistently confuses the user (even not doing the *wrong*
>> thing consistently confuses the user. In this case the wrong thing is
>> rewriting the From: header of every email).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68686; Package emacs. (Thu, 25 Jan 2024 08:32:02 GMT) Full text and rfc822 format available.

Message #14 received at 68686 <at> debbugs.gnu.org (full text, mbox):

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: rameiko87 <at> posteo.net
Cc: 68686 <at> debbugs.gnu.org
Subject: Re: bug#68686: [Bug] smtpmail-send-queued-mail ignores some headers
 of the message it's sending!
Date: Thu, 25 Jan 2024 09:31:39 +0100
rameiko87 <at> posteo.net writes:

[...]

> smtpmail-send-queued-mail: Sending failed: 504 5.5.2 <user <at> fedora>:
> Sender address rejected: need fully-qualified address

This is strange because I have followed your recipe (manually modifying
To: and From: to manuel <at> ledu-giraud.fr) and it works as expected: the
message is delivered and there is no trace of the local user/hostname in
it.
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68686; Package emacs. (Thu, 25 Jan 2024 10:00:02 GMT) Full text and rfc822 format available.

Message #17 received at 68686 <at> debbugs.gnu.org (full text, mbox):

From: rameiko87 <at> posteo.net
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: 68686 <at> debbugs.gnu.org
Subject: Re: bug#68686: [Bug] smtpmail-send-queued-mail ignores some headers
 of the message it's sending!
Date: Thu, 25 Jan 2024 09:58:55 +0000
We need to get to the bottom of this! If the steps are the same then you 
must be using a different version... Are you using Emacs 29.1?

On 25.01.2024 09:31, Manuel Giraud wrote:
> 
> [...]
> 
>> smtpmail-send-queued-mail: Sending failed: 504 5.5.2 <user <at> fedora>:
>> Sender address rejected: need fully-qualified address
> 
> This is strange because I have followed your recipe (manually modifying
> To: and From: to manuel <at> ledu-giraud.fr) and it works as expected: the
> message is delivered and there is no trace of the local user/hostname 
> in
> it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68686; Package emacs. (Thu, 25 Jan 2024 10:49:01 GMT) Full text and rfc822 format available.

Message #20 received at 68686 <at> debbugs.gnu.org (full text, mbox):

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: rameiko87 <at> posteo.net
Cc: 68686 <at> debbugs.gnu.org
Subject: Re: bug#68686: [Bug] smtpmail-send-queued-mail ignores some headers
 of the message it's sending!
Date: Thu, 25 Jan 2024 11:48:36 +0100
rameiko87 <at> posteo.net writes:

> We need to get to the bottom of this! If the steps are the same then
> you must be using a different version... Are you using Emacs 29.1?

Yes I'm on recent master.  I'll test on 29.1.
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68686; Package emacs. (Fri, 26 Jan 2024 11:22:01 GMT) Full text and rfc822 format available.

Message #23 received at 68686 <at> debbugs.gnu.org (full text, mbox):

From: rameiko87 <at> posteo.net
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: 68686 <at> debbugs.gnu.org
Subject: Re: bug#68686: [Bug] smtpmail-send-queued-mail ignores some headers
 of the message it's sending!
Date: Fri, 26 Jan 2024 11:21:34 +0000
Please do, because 29.2 is not packaged for guix, so I don't know how to 
install it. Otherwise I would test myself with 29.2...

On 25.01.2024 11:48, Manuel Giraud wrote:
> 
>> We need to get to the bottom of this! If the steps are the same then
>> you must be using a different version... Are you using Emacs 29.1?
> 
> Yes I'm on recent master.  I'll test on 29.1.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68686; Package emacs. (Fri, 26 Jan 2024 15:38:02 GMT) Full text and rfc822 format available.

Message #26 received at 68686 <at> debbugs.gnu.org (full text, mbox):

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: rameiko87 <at> posteo.net
Cc: 68686 <at> debbugs.gnu.org
Subject: Re: bug#68686: [Bug] smtpmail-send-queued-mail ignores some headers
 of the message it's sending!
Date: Fri, 26 Jan 2024 16:37:37 +0100
rameiko87 <at> posteo.net writes:

> Please do, because 29.2 is not packaged for guix, so I don't know how
> to install it. Otherwise I would test myself with 29.2...

Hi,

So I did the following test on 29.1 (built from source from the
emacs-29.1 branch):

      - emacs -Q
      - M-: (setq send-mail-function 'smtpmail-send-it
                  smtpmail-queue-mail t
                  smtpmail-smtp-server "ledu-giraud.fr")
      - M-: (compose-mail)
      [ manually change "To:" and "From:" to manuel <at> ledu-giraud.fr ]
      - C-c C-c
      - M-: (smtpmail-send-queued-mail)

And this mail is correctly delivered.  The only trace left of the local
hostname is in "Message-ID:" which was set to
<87dvxoapt1.fsf <at> computer.mail-host-address-is-not-set>

So, I cannot see evidence of a bug in Emacs here.
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68686; Package emacs. (Sat, 27 Jan 2024 01:10:02 GMT) Full text and rfc822 format available.

Message #29 received at 68686 <at> debbugs.gnu.org (full text, mbox):

From: rameiko87 <at> posteo.net
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: 68686 <at> debbugs.gnu.org
Subject: Re: bug#68686: [Bug] smtpmail-send-queued-mail ignores some headers
 of the message it's sending!
Date: Sat, 27 Jan 2024 01:09:19 +0000
On 26.01.2024 16:37, Manuel Giraud wrote:
> 
>> Please do, because 29.2 is not packaged for guix, so I don't know how
>> to install it. Otherwise I would test myself with 29.2...
> 
> Hi,
> 
> So I did the following test on 29.1 (built from source from the
> emacs-29.1 branch):
> 
>       - emacs -Q
>       - M-: (setq send-mail-function 'smtpmail-send-it
>                   smtpmail-queue-mail t
>                   smtpmail-smtp-server "ledu-giraud.fr")
>       - M-: (compose-mail)
>       [ manually change "To:" and "From:" to manuel <at> ledu-giraud.fr ]
>       - C-c C-c
>       - M-: (smtpmail-send-queued-mail)
> 
> And this mail is correctly delivered.  The only trace left of the local
> hostname is in "Message-ID:" which was set to
> <87dvxoapt1.fsf <at> computer.mail-host-address-is-not-set>
> 
> So, I cannot see evidence of a bug in Emacs here.

Ok I think I solved the conundrum! It has to do with the "envelope 
From", and I think the reason why you can't reproduce the error is 
because your smtp server allows envelope-from which are different from 
the From: header (and my smtp server doesn't). So you don't _see_ the 
bug. Let's keep start emacs -Q and let's set the parameters we 
discussed.

For some reason, the envelope-from when sending via 
smtpmail-send-queued-mail is assigned to the value of user-mail-address 
(which for me was user <at> fedora) independently of the From: header. But 
with "immediate sending" this doesn't happen (I wonder if it's assigned 
to the same value as the header, or is not assigned at all and the smtp 
server assigns it? I don't know much about how these protocols work). In 
fact, if I just set a valid email for user-mail-address, then I get a 
different error, that is "envelope-from mismatches the From: header". 
Now, I could solve it by fiddling with

'(mail-envelope-from 'header)
'(mail-specify-envelope-from t)

and at this point I can send queued email, but this is really a fishy 
business and this fact that the value assigned to envelope-from changes 
between using "immediate sending" and queued-sending I think is the real 
core of the bug. Because I don't want the envelopes which I prescribed 
above to insert a header X-Authentication-Warning in my message, then I 
set '(message-sendmail-f-is-evil t), and looking at the description of 
this variable I discover it mentions bug#36937 which is very similar to 
the strange behaviour I described.

I will try to explore, with more calm and over the next few weeks, what 
is going on. But this is really a fishy business!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68686; Package emacs. (Sat, 27 Jan 2024 11:27:02 GMT) Full text and rfc822 format available.

Message #32 received at 68686 <at> debbugs.gnu.org (full text, mbox):

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: rameiko87 <at> posteo.net
Cc: 68686 <at> debbugs.gnu.org
Subject: Re: bug#68686: [Bug] smtpmail-send-queued-mail ignores some headers
 of the message it's sending!
Date: Sat, 27 Jan 2024 12:25:56 +0100
rameiko87 <at> posteo.net writes:

> On 26.01.2024 16:37, Manuel Giraud wrote:
>> 
>>> Please do, because 29.2 is not packaged for guix, so I don't know how
>>> to install it. Otherwise I would test myself with 29.2...
>> Hi,
>> So I did the following test on 29.1 (built from source from the
>> emacs-29.1 branch):
>>       - emacs -Q
>>       - M-: (setq send-mail-function 'smtpmail-send-it
>>                   smtpmail-queue-mail t
>>                   smtpmail-smtp-server "ledu-giraud.fr")
>>       - M-: (compose-mail)
>>       [ manually change "To:" and "From:" to manuel <at> ledu-giraud.fr ]
>>       - C-c C-c
>>       - M-: (smtpmail-send-queued-mail)
>> And this mail is correctly delivered.  The only trace left of the
>> local
>> hostname is in "Message-ID:" which was set to
>> <87dvxoapt1.fsf <at> computer.mail-host-address-is-not-set>
>> So, I cannot see evidence of a bug in Emacs here.
>
> Ok I think I solved the conundrum! It has to do with the "envelope
> From", and I think the reason why you can't reproduce the error is
> because your smtp server allows envelope-from which are different from
> the From: header (and my smtp server doesn't). So you don't _see_ the
> bug. Let's keep start emacs -Q and let's set the parameters we
> discussed.
>
> For some reason, the envelope-from when sending via
> smtpmail-send-queued-mail is assigned to the value of
> user-mail-address (which for me was user <at> fedora) independently of the
> From: header. But with "immediate sending" this doesn't happen (I
> wonder if it's assigned to the same value as the header, or is not
> assigned at all and the smtp server assigns it? I don't know much
> about how these protocols work). In fact, if I just set a valid email
> for user-mail-address, then I get a different error, that is
> "envelope-from mismatches the From: header". Now, I could solve it by
> fiddling with
>
> '(mail-envelope-from 'header)
> '(mail-specify-envelope-from t)
>
> and at this point I can send queued email, but this is really a fishy
> business and this fact that the value assigned to envelope-from
> changes between using "immediate sending" and queued-sending I think
> is the real core of the bug.

Good.  It seems that you have tracked this issue down.  You're right
that the behaviour between "queued sending" and "immediate sending"
should not diverge here.  But on this matter it seems that there is a
lot of possible customization: for example, in message.el, there is also
'message-sendmail-envelope-from'.
-- 
Manuel Giraud




This bug report was last modified 1 year and 141 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.