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

From: [email-masked]
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@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).