1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-18 14:47:03 +00:00

queue: Use a local envelope-from when forwarding

If there's an alias to forward email to a non-local domain, using the original
From is problematic, as we may not be an authorized sender for it.

Some MTAs (like Exim) will do it anyway, others (like gmail) will construct a
special address based on the original address.

This patch implements the latter approach, which is safer and allows the
receiver to properly enforce SPF.

We construct a (hopefully) reasonable From based on the local user, and
embedding the original From (but transformed for IDNA, as the receiver may not
support SMTPUTF8).
This commit is contained in:
Alberto Bertogli
2016-10-03 00:49:32 +01:00
parent afd79dfd8d
commit 55b03c8cf0
6 changed files with 83 additions and 41 deletions

View File

@@ -10,9 +10,9 @@ func TestDSN(t *testing.T) {
To: []string{"toto@africa.org", "negra@sosa.org"},
Rcpt: []*Recipient{
{"poe@rcpt", Recipient_EMAIL, Recipient_FAILED,
"oh! horror!"},
"oh! horror!", ""},
{"newman@rcpt", Recipient_EMAIL, Recipient_FAILED,
"oh! the humanity!"}},
"oh! the humanity!", ""}},
Data: []byte("data ñaca"),
Hostname: "from.org",
},