msmtp icon indicating copy to clipboard operation
msmtp copied to clipboard

feature: add set_to_header option

Open lukastribus opened this issue 1 week ago • 1 comments

Hello,

thank you for your time and effort in this project, it is very useful for me.

We are not always in control of how the headers look like and sometimes we need to overwrite them. That is why multiple very useful set_*_header features exist, including set_from_header.

Regarding To: however msmtp only replaces envelope to, not the To header, as expected and documented.

Interestingly I now have exactly this problem.

The box is trying to send to root, aliasing takes care of the envelope to, however AWS SES rejects the email due to the To header with:

554 Transaction failed: Missing final '@domain'

I have to workaround the issue with:

undisclosed_recipients on

which I would rather not, I just want set the To header to the same as the envelope (defined in the aliases configuration).

A set_to_header option would fix this.

I cannot solve this problem at the caller site, because there are lots of applications that will try to send to root, I do not know them beforehand and I cannot fix them all; my intention is to get root mail transported reliably off the machine.

Thank you for the consideration.

Lukas

lukastribus avatar Feb 13 '25 23:02 lukastribus