mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-18 14:47:03 +00:00
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).
28 lines
558 B
Go
28 lines
558 B
Go
package queue
|
|
|
|
import "testing"
|
|
|
|
func TestDSN(t *testing.T) {
|
|
item := &Item{
|
|
Message: Message{
|
|
ID: <-newID,
|
|
From: "from@from.org",
|
|
To: []string{"toto@africa.org", "negra@sosa.org"},
|
|
Rcpt: []*Recipient{
|
|
{"poe@rcpt", Recipient_EMAIL, Recipient_FAILED,
|
|
"oh! horror!", ""},
|
|
{"newman@rcpt", Recipient_EMAIL, Recipient_FAILED,
|
|
"oh! the humanity!", ""}},
|
|
Data: []byte("data ñaca"),
|
|
Hostname: "from.org",
|
|
},
|
|
}
|
|
|
|
msg, err := deliveryStatusNotification(item)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
t.Log(string(msg))
|
|
}
|