Skip to content

Commit

Permalink
Move MailOptions to smtp.go
Browse files Browse the repository at this point in the history
This struct is used by both the server and the client.
  • Loading branch information
emersion committed Aug 14, 2023
1 parent d666ea9 commit d576c01
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
37 changes: 0 additions & 37 deletions backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
37 changes: 37 additions & 0 deletions smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit d576c01

Please sign in to comment.