From d576c011e4b5dafc03d2a67f1dc3339a19ac5c26 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 14 Aug 2023 12:56:48 +0200 Subject: [PATCH] Move MailOptions to smtp.go This struct is used by both the server and the client. --- backend.go | 37 ------------------------------------- smtp.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/backend.go b/backend.go index c2909da..2f28880 100644 --- a/backend.go +++ b/backend.go @@ -27,43 +27,6 @@ type Backend interface { NewSession(c *Conn) (Session, error) } -type BodyType string - -const ( - Body7Bit BodyType = "7BIT" - Body8BitMIME BodyType = "8BITMIME" - BodyBinaryMIME BodyType = "BINARYMIME" -) - -// MailOptions contains custom arguments that were -// passed as an argument to the MAIL command. -type MailOptions struct { - // Value of BODY= argument, 7BIT, 8BITMIME or BINARYMIME. - Body BodyType - - // Size of the body. Can be 0 if not specified by client. - Size int64 - - // TLS is required for the message transmission. - // - // The message should be rejected if it can't be transmitted - // with TLS. - RequireTLS bool - - // The message envelope or message header contains UTF-8-encoded strings. - // This flag is set by SMTPUTF8-aware (RFC 6531) client. - UTF8 bool - - // The authorization identity asserted by the message sender in decoded - // form with angle brackets stripped. - // - // nil value indicates missing AUTH, non-nil empty string indicates - // AUTH=<>. - // - // Defined in RFC 4954. - Auth *string -} - // Session is used by servers to respond to an SMTP client. // // The methods are called when the remote client issues the matching command. diff --git a/smtp.go b/smtp.go index 356613f..50c68fb 100644 --- a/smtp.go +++ b/smtp.go @@ -15,3 +15,40 @@ // // Additional extensions may be handled by other packages. package smtp + +type BodyType string + +const ( + Body7Bit BodyType = "7BIT" + Body8BitMIME BodyType = "8BITMIME" + BodyBinaryMIME BodyType = "BINARYMIME" +) + +// MailOptions contains custom arguments that were +// passed as an argument to the MAIL command. +type MailOptions struct { + // Value of BODY= argument, 7BIT, 8BITMIME or BINARYMIME. + Body BodyType + + // Size of the body. Can be 0 if not specified by client. + Size int64 + + // TLS is required for the message transmission. + // + // The message should be rejected if it can't be transmitted + // with TLS. + RequireTLS bool + + // The message envelope or message header contains UTF-8-encoded strings. + // This flag is set by SMTPUTF8-aware (RFC 6531) client. + UTF8 bool + + // The authorization identity asserted by the message sender in decoded + // form with angle brackets stripped. + // + // nil value indicates missing AUTH, non-nil empty string indicates + // AUTH=<>. + // + // Defined in RFC 4954. + Auth *string +}