-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client: Change Mail to accept optional MailOptions
- Loading branch information
Showing
3 changed files
with
15 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,7 +99,7 @@ func TestBasic(t *testing.T) { | |
t.Fatalf("Shouldn't support DSN") | ||
} | ||
|
||
if err := c.Mail("[email protected]"); err == nil { | ||
if err := c.Mail("[email protected]", nil); err == nil { | ||
t.Fatalf("MAIL should require authentication") | ||
} | ||
|
||
|
@@ -123,10 +123,10 @@ func TestBasic(t *testing.T) { | |
if err := c.Rcpt("[email protected]>\r\nDATA\r\nInjected message body\r\n.\r\nQUIT\r\n"); err == nil { | ||
t.Fatalf("RCPT should have failed due to a message injection attempt") | ||
} | ||
if err := c.Mail("[email protected]>\r\nDATA\r\nAnother injected message body\r\n.\r\nQUIT\r\n"); err == nil { | ||
if err := c.Mail("[email protected]>\r\nDATA\r\nAnother injected message body\r\n.\r\nQUIT\r\n", nil); err == nil { | ||
t.Fatalf("MAIL should have failed due to a message injection attempt") | ||
} | ||
if err := c.Mail("[email protected]"); err != nil { | ||
if err := c.Mail("[email protected]", nil); err != nil { | ||
t.Fatalf("MAIL failed: %s", err) | ||
} | ||
if err := c.Rcpt("[email protected]"); err != nil { | ||
|
@@ -187,7 +187,7 @@ func TestBasic_SMTPError(t *testing.T) { | |
t.Fatalf("NewClient failed: %v", err) | ||
} | ||
|
||
err = c.Mail("whatever") | ||
err = c.Mail("whatever", nil) | ||
if err == nil { | ||
t.Fatal("MAIL succeded") | ||
} | ||
|
@@ -205,7 +205,7 @@ func TestBasic_SMTPError(t *testing.T) { | |
t.Fatalf("Wrong message, got %s, want %s", smtpErr.Message, "Failing with enhanced code") | ||
} | ||
|
||
err = c.Mail("whatever") | ||
err = c.Mail("whatever", nil) | ||
if err == nil { | ||
t.Fatal("MAIL succeded") | ||
} | ||
|
@@ -385,7 +385,7 @@ func TestHello(t *testing.T) { | |
c.serverName = "smtp.google.com" | ||
err = c.Auth(sasl.NewPlainClient("", "user", "pass")) | ||
case 4: | ||
err = c.Mail("[email protected]") | ||
err = c.Mail("[email protected]", nil) | ||
case 5: | ||
ok, _ := c.Extension("feature") | ||
if ok { | ||
|
@@ -851,7 +851,7 @@ func TestLMTP(t *testing.T) { | |
} | ||
c.didHello = true | ||
|
||
if err := c.Mail("[email protected]"); err != nil { | ||
if err := c.Mail("[email protected]", nil); err != nil { | ||
t.Fatalf("MAIL failed: %s", err) | ||
} | ||
if err := c.Rcpt("[email protected]"); err != nil { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ func ExampleDial() { | |
} | ||
|
||
// Set the sender and recipient first | ||
if err := c.Mail("[email protected]"); err != nil { | ||
if err := c.Mail("[email protected]", nil); err != nil { | ||
log.Fatal(err) | ||
} | ||
if err := c.Rcpt("[email protected]"); err != nil { | ||
|