mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-14 18:02:55 +01:00
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.
This commit is contained in:
parent
ef3da39840
commit
f7c12d412b
2 changed files with 11 additions and 11 deletions
12
client.go
12
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 {
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue