From 64a19b7e0485136939c8458a5cbe44d9f49034d8 Mon Sep 17 00:00:00 2001 From: kayrus Date: Thu, 15 Jul 2021 13:10:32 +0200 Subject: [PATCH] Change smtp.MailOptions to a pointer --- backend.go | 2 +- backendutil/transform.go | 2 +- backendutil/transform_test.go | 2 +- cmd/smtp-debug-server/main.go | 2 +- conn.go | 2 +- example_test.go | 2 +- server_test.go | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend.go b/backend.go index e4de6af..9885d8e 100644 --- a/backend.go +++ b/backend.go @@ -72,7 +72,7 @@ type Session interface { AuthPlain(username, password string) 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. diff --git a/backendutil/transform.go b/backendutil/transform.go index 55a7da2..aae0ab8 100755 --- a/backendutil/transform.go +++ b/backendutil/transform.go @@ -37,7 +37,7 @@ func (s *transformSession) AuthPlain(username, password string) error { return s.Session.AuthPlain(username, password) } -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) diff --git a/backendutil/transform_test.go b/backendutil/transform_test.go index 5a85865..471bfc1 100755 --- a/backendutil/transform_test.go +++ b/backendutil/transform_test.go @@ -56,7 +56,7 @@ func (s *session) AuthPlain(username, password string) 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.userErr != nil { return s.backend.userErr } diff --git a/cmd/smtp-debug-server/main.go b/cmd/smtp-debug-server/main.go index 8c4c65b..38d0a90 100644 --- a/cmd/smtp-debug-server/main.go +++ b/cmd/smtp-debug-server/main.go @@ -27,7 +27,7 @@ func (s *session) AuthPlain(username, password string) error { return nil } -func (s *session) Mail(from string, opts smtp.MailOptions) error { +func (s *session) Mail(from string, opts *smtp.MailOptions) error { return nil } diff --git a/conn.go b/conn.go index 526c3c3..ff497d3 100644 --- a/conn.go +++ b/conn.go @@ -321,7 +321,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 diff --git a/example_test.go b/example_test.go index 65a829b..89d09f8 100644 --- a/example_test.go +++ b/example_test.go @@ -108,7 +108,7 @@ func (s *Session) AuthPlain(username, password string) error { return nil } -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 } diff --git a/server_test.go b/server_test.go index 09a0e22..48cdb12 100644 --- a/server_test.go +++ b/server_test.go @@ -17,7 +17,7 @@ type message struct { From string To []string Data []byte - Opts smtp.MailOptions + Opts *smtp.MailOptions } type backend struct { @@ -79,7 +79,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.userErr != nil { return s.backend.userErr }