Skip to content

Commit

Permalink
Change smtp.MailOptions to a pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
kayrus committed Jul 15, 2021
1 parent 26eb481 commit db377e4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type Session interface {
Logout() error

// Set return path for currently processed message.
Mail(from string, opts MailOptions) error
Mail(from string, opts *MailOptions) error
// Add recipient for currently processed message.
Rcpt(to string) error
// Set currently processed message contents and send it.
Expand Down
2 changes: 1 addition & 1 deletion backendutil/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (s *transformSession) Reset() {
s.Session.Reset()
}

func (s *transformSession) Mail(from string, opts smtp.MailOptions) error {
func (s *transformSession) Mail(from string, opts *smtp.MailOptions) error {
if s.be.TransformMail != nil {
var err error
from, err = s.be.TransformMail(from)
Expand Down
2 changes: 1 addition & 1 deletion backendutil/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (s *session) Logout() error {
return nil
}

func (s *session) Mail(from string, opts smtp.MailOptions) error {
func (s *session) Mail(from string, opts *smtp.MailOptions) error {
s.Reset()
s.msg.From = from
return nil
Expand Down
2 changes: 1 addition & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func (c *Conn) handleMail(arg string) {
}
from = strings.Trim(from, "<>")

opts := MailOptions{}
opts := &MailOptions{}

c.binarymime = false
// This is where the Conn may put BODY=8BITMIME, but we already
Expand Down
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (bkd *Backend) AnonymousLogin(state *smtp.ConnectionState) (smtp.Session, e
// A Session is returned after successful login.
type Session struct{}

func (s *Session) Mail(from string, opts smtp.MailOptions) error {
func (s *Session) Mail(from string, opts *smtp.MailOptions) error {
log.Println("Mail from:", from)
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type message struct {
From string
To []string
Data []byte
Opts smtp.MailOptions
Opts *smtp.MailOptions
}

type backend struct {
Expand Down Expand Up @@ -91,7 +91,7 @@ func (s *session) Logout() error {
return nil
}

func (s *session) Mail(from string, opts smtp.MailOptions) error {
func (s *session) Mail(from string, opts *smtp.MailOptions) error {
if s.backend.panicOnMail {
panic("Everything is on fire!")
}
Expand Down

0 comments on commit db377e4

Please sign in to comment.