1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

queue: Send delivery status notifications on failures

When we permanently failed to deliver to one or more recipients, send delivery
status notifications back to the sender.

To do this, we need to extend a couple of internal structures, to keep track
of the original destinations (so we can include them in the message, for
reference), and the hostname we're identifying ourselves as (this is arguable
but we're going with it for now, may change later).
This commit is contained in:
Alberto Bertogli
2016-09-25 15:50:17 +01:00
parent 927a74aa3c
commit 1d3675a133
10 changed files with 226 additions and 65 deletions

View File

@@ -0,0 +1,27 @@
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))
}