ProtonMail / proton-bridge

Proton Mail Bridge application
GNU General Public License v3.0
1.14k stars 155 forks source link

Resent-* headers are stripped when using the bridge SMTP api #306

Closed oleduc closed 1 year ago

oleduc commented 1 year ago

I'm attempting to use Resent-* and Reply-To headers but all of these headers seem to be stripped by the time the email has been sent. I tested sending emails to proton and gmail and the behavior is the same.

Expected Behavior

When Resent-* headers are sent with an email, they should be present in the received email.

Current Behavior

All Resent-* headers are ignored and stripped.

Possible Solution

Passing Resent-* and Reply-To headers as specified in RFC 822 4.2

Steps to Reproduce

Send a message with the following headers:

Content-Type: multipart/alternative;
MIME-Version: 1.0
From: forwarder@test.com
To: recipient@test.com
Subject: A email being forwarded using proton bridge
Reply-To: original-sender@test.com
Resent-Subject: Original Subject
Resent-To: recipient@test.com
Resent-From:  original-sender@test.com
Resent-Date: Mon, 19 Sep 2022 20:05:41 +0000 (UTC)
Resent-Message-ID: example-id

Version Information

2.3.0

Context (Environment)

I'm trying to implement an email forwarder using proton bridge as this feature isn't supported by Protonmail and being able to somehow preserve the original date and sender information without altering the email body would be ideal.

Detailed Description

The headers should be validated according to RFC 822 passed along and not stripped.

https://www.w3.org/Protocols/rfc822/

     Some systems permit mail recipients to  forward  a  message,
retaining  the original headers, by adding some new fields.  This
standard supports such a service, through the "Resent-" prefix to
field names.

     Whenever the string "Resent-" begins a field name, the field
has  the  same  semantics as a field whose name does not have the
prefix.  However, the message is assumed to have  been  forwarded
by  an original recipient who attached the "Resent-" field.  This
new field is treated as being more recent  than  the  equivalent,
original  field.   For  example, the "Resent-From", indicates the
person that forwarded the message, whereas the "From" field indi-
cates the original author.

     Use of such precedence  information  depends  upon  partici-
pants'  communication needs.  For example, this standard does not
dictate when a "Resent-From:" address should receive replies,  in
lieu of sending them to the "From:" address.

Note:  In general, the "Resent-" fields should be treated as con-
       taining  a  set  of information that is independent of the
       set of original fields.  Information for  one  set  should
       not  automatically be taken from the other.  The interpre-
       tation of multiple "Resent-" fields, of the same type,  is
       undefined.
LBeernaertProton commented 1 year ago

Hey @oleduc , could you try one of the beta versions (3.0.x) and see if the issue still persists?

andrzejsza commented 1 year ago

assuming it does not, closing.

jameshoulahan commented 1 year ago

This is unfortunately due to a proton server limitation, not a bridge limitation. The server only accepts a whitelist of outgoing headers (simple things e.g. To, Subject etc) so as to not accidentally leak private information set in the headers by the email client. Currently, Resent-* headers are not part of this whitelist. As such, this will not work with v3 builds either.