From f7c12d412be96c881cce32d5f746e2c426a87bd6 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Fri, 4 Oct 2024 20:30:43 +0200 Subject: [PATCH] Rename dsnmrtype to dsnReturnType in client.go Refactor variable names for consistency. The `dsnmrtype` variable has been renamed to `dsnReturnType` across the client and test files to improve code readability and maintain uniformity. --- client.go | 12 ++++++------ client_test.go | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/client.go b/client.go index 6885d90..48d36dd 100644 --- a/client.go +++ b/client.go @@ -106,8 +106,8 @@ type ( // dialContextFunc is the DialContextFunc that is used by the Client to connect to the SMTP server. dialContextFunc DialContextFunc - // dsnmrtype defines the DSNMailReturnOption in case DSN is enabled - dsnmrtype DSNMailReturnOption + // dsnReturnType defines the DSNMailReturnOption in case DSN is enabled + dsnReturnType DSNMailReturnOption // dsnrntype defines the DSNRcptNotifyOption in case DSN is enabled dsnrntype []string @@ -398,7 +398,7 @@ func WithPassword(password string) Option { func WithDSN() Option { return func(c *Client) error { c.requestDSN = true - c.dsnmrtype = DSNMailReturnFull + c.dsnReturnType = DSNMailReturnFull c.dsnrntype = []string{string(DSNRcptNotifyFailure), string(DSNRcptNotifySuccess)} return nil } @@ -418,7 +418,7 @@ func WithDSNMailReturnType(option DSNMailReturnOption) Option { } c.requestDSN = true - c.dsnmrtype = option + c.dsnReturnType = option return nil } } @@ -874,8 +874,8 @@ func (c *Client) sendSingleMsg(message *Msg) error { } if c.requestDSN { - if c.dsnmrtype != "" { - c.smtpClient.SetDSNMailReturnOption(string(c.dsnmrtype)) + if c.dsnReturnType != "" { + c.smtpClient.SetDSNMailReturnOption(string(c.dsnReturnType)) } } if err = c.smtpClient.Mail(from); err != nil { diff --git a/client_test.go b/client_test.go index 7c6f00e..47ffab8 100644 --- a/client_test.go +++ b/client_test.go @@ -486,9 +486,9 @@ func TestWithDSN(t *testing.T) { if !c.requestDSN { t.Errorf("WithDSN failed. c.requestDSN expected to be: %t, got: %t", true, c.requestDSN) } - if c.dsnmrtype != DSNMailReturnFull { - t.Errorf("WithDSN failed. c.dsnmrtype expected to be: %s, got: %s", DSNMailReturnFull, - c.dsnmrtype) + if c.dsnReturnType != DSNMailReturnFull { + t.Errorf("WithDSN failed. c.dsnReturnType expected to be: %s, got: %s", DSNMailReturnFull, + c.dsnReturnType) } if c.dsnrntype[0] != string(DSNRcptNotifyFailure) { t.Errorf("WithDSN failed. c.dsnrntype[0] expected to be: %s, got: %s", DSNRcptNotifyFailure, @@ -519,8 +519,8 @@ func TestWithDSNMailReturnType(t *testing.T) { t.Errorf("failed to create new client: %s", err) return } - if string(c.dsnmrtype) != tt.want { - t.Errorf("WithDSNMailReturnType failed. Expected %s, got: %s", tt.want, string(c.dsnmrtype)) + if string(c.dsnReturnType) != tt.want { + t.Errorf("WithDSNMailReturnType failed. Expected %s, got: %s", tt.want, string(c.dsnReturnType)) } }) }