From 04dd5652f266e0abb433b5a4d7af8ae7cc2dc924 Mon Sep 17 00:00:00 2001 From: Marcel Link Date: Thu, 22 Aug 2024 10:07:19 +0200 Subject: [PATCH] feat: XOORG support --- conn.go | 9 +++++++++ server.go | 4 ++++ smtp.go | 3 +++ 3 files changed, 16 insertions(+) diff --git a/conn.go b/conn.go index ec9f686..2c3605e 100644 --- a/conn.go +++ b/conn.go @@ -276,6 +276,9 @@ func (c *Conn) handleGreet(enhanced bool, arg string) { if c.server.EnableDSN { caps = append(caps, "DSN") } + if c.server.EnableXOORG { + caps = append(caps, "XOORG") + } if c.server.MaxMessageBytes > 0 { caps = append(caps, fmt.Sprintf("SIZE %v", c.server.MaxMessageBytes)) } else { @@ -339,6 +342,12 @@ func (c *Conn) handleMail(arg string) { } opts.Size = int64(size) + case "XOORG": + if !c.server.EnableXOORG { + c.writeResponse(504, EnhancedCode{5, 5, 4}, "EnableXOORG is not implemented") + return + } + opts.XOORG = value case "SMTPUTF8": if !c.server.EnableSMTPUTF8 { c.writeResponse(504, EnhancedCode{5, 5, 4}, "SMTPUTF8 is not implemented") diff --git a/server.go b/server.go index 7c23a31..d1ebbae 100644 --- a/server.go +++ b/server.go @@ -57,6 +57,10 @@ type Server struct { // Should be used only if backend supports it. EnableDSN bool + // Advertise XOORG capability. + // Should be used only if backend supports it. + EnableXOORG bool + // The server backend. Backend Backend diff --git a/smtp.go b/smtp.go index 9563b11..ab0c105 100644 --- a/smtp.go +++ b/smtp.go @@ -56,6 +56,9 @@ type MailOptions struct { // Envelope identifier set by the client. EnvelopeID string + // Accepted Domain from Exchange Online, e.g. from OutgoingConnector + XOORG string + // The authorization identity asserted by the message sender in decoded // form with angle brackets stripped. //