mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 17:44:35 +03:00
better thread matching for dsns
keep track of whether a message is a dsn, and match dsn's against their sent message by ignoring the message subject.
This commit is contained in:
@ -575,6 +575,15 @@ func (p *Part) ParseNextPart(elog *slog.Logger) (*Part, error) {
|
||||
return &p.Parts[len(p.Parts)-1], nil
|
||||
}
|
||||
|
||||
// IsDSN returns whether the MIME structure of the part is a DSN.
|
||||
func (p *Part) IsDSN() bool {
|
||||
return p.MediaType == "MULTIPART" &&
|
||||
p.MediaSubType == "REPORT" &&
|
||||
len(p.Parts) >= 2 &&
|
||||
p.Parts[1].MediaType == "MESSAGE" &&
|
||||
(p.Parts[1].MediaSubType == "DELIVERY-STATUS" || p.Parts[1].MediaSubType == "GLOBAL-DELIVERY-STATUS")
|
||||
}
|
||||
|
||||
// Reader returns a reader for the decoded body content.
|
||||
func (p *Part) Reader() io.Reader {
|
||||
return p.bodyReader(p.RawReader())
|
||||
|
Reference in New Issue
Block a user