darcs

Issue 2736 should `darcs send` set the From: header?

Title should `darcs send` set the From: header?
Priority Status unknown
Milestone Resolved in
Superseder Nosy List bfrk
Assigned To
Topics

Created on 2024-11-09.17:17:50 by bfrk, last changed 2024-11-12.03:28:00 by bfrk.

Messages
msg24095 (view) Author: bfrk Date: 2024-11-09.17:17:45
I just ran into this issue: For testing purposes I had set _darcs/prefs/author 
to some random text (not a valid email address). This subsequently caused 
`darcs send` to fail. Specifically, my provider's smtp server rejected the 
email, citing "policy restrictions". I then hacked darcs so that it provides 
me with a copy of the email file it pipes into sendmail. Looking at this file 
explained why the email was rejected: it did not have a correct "From:" header 
because apparently darcs uses _darcs/prefs/author (if one exists) as the 
content for the "From:" header.

I think we should not do that. It is nowhere documented that the patch author 
must be a valid email address (even though everyone seems to have adopted that 
as a convention and I have no trouble with that). Setting the "From:" header 
should be left to the sending email client.

As a work-around I have now configured msmtp to always set the "From:" header, 
overriding any that may be present in the email (`set_from_header on`).
msg24096 (view) Author: ganesh Date: 2024-11-09.17:28:00
Will sendmail (or whatever is providing that command locally) always set a 
sensible From address?

If so I agree that it should "win" because what you chose as the patch 
author is not necessarily the same as who you want to send email from.
msg24103 (view) Author: bfrk Date: 2024-11-12.03:06:14
> Will sendmail (or whatever is providing that command locally) always set 
a sensible From address?

A very good question.

After some reading on the internet I get the impression that this is in 
fact not the case. There seems to be consensus that setting From: header is 
the job of the MUA i.e. email client; and sendmail is basically a MTA, not 
MUA. This would make Darcs the MUA and thus responsible for setting the 
From: address. While I am pretty sure that almost all MTAs running on the 
user's host /can/ be configured to set or even override the From: address, 
the question is whether Darcs should require the user to do that in order 
for `darcs send` to work correctly. I tend to think this is probably not 
such a good idea after all.

Perhaps the better solution is to check if _darcs/prefs/author is a valid 
email address (syntactically) and prompt the user for the sender address 
otherwise?

BTW, there is also the --from option (to darcs send). The user can set this 
option in their ~/.darcs/defaults, which is certainly easier to do than dig 
through the unwieldy mess of documentation for their MTA (msmtp is the 
exception here) to find a way to convince it to set From address properly.
msg24104 (view) Author: bfrk Date: 2024-11-12.03:28:00
I also found out by experimenting that if there is no 
_darcs/prefs/author, then Darcs uses ~/.darcs/author. If that has more 
than one author, it asks you which one to use (and then stores it in 
_darcs/prefs/author, but that's another ticket), exactly like `darcs 
record` does. And --from overrides all of those.
History
Date User Action Args
2024-11-09 17:17:50bfrkcreate
2024-11-09 17:28:01ganeshsetmessages: + msg24096
2024-11-12 03:06:16bfrksetmessages: + msg24103
2024-11-12 03:28:00bfrksetmessages: + msg24104