-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
96 additions
and
12 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
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 |
---|---|---|
|
@@ -6,18 +6,19 @@ import ( | |
|
||
// Provide a valid smtp config | ||
var ( | ||
host = "mail.xxx.com" | ||
user = "[email protected]" | ||
pass = "xxx" | ||
recipent = "[email protected]" | ||
host = "mail.xxx.com" | ||
user = "[email protected]" | ||
pass = "xxx" | ||
recipent = "[email protected]" | ||
recipent2 = "[email protected]" | ||
) | ||
|
||
func TestSMTP(t *testing.T) { | ||
mail := NewMail() | ||
mail.FromName = "Go Mailer" | ||
mail.From = user | ||
mail.Subject = "Go SMTP Test" | ||
mail.Body = "This is a test mail from Go Mailer via SMTP" | ||
mail.Body = "This is a test e-mail from Go Mailer via SMTP" | ||
mail.SetTo(recipent) | ||
|
||
mailer := NewMailer(host, 25, user, pass, false) | ||
|
@@ -31,8 +32,17 @@ func TestSMTPSSL(t *testing.T) { | |
mail.FromName = "Go Mailer" | ||
mail.From = user | ||
mail.Subject = "Go SMTP SSL Test" | ||
mail.Body = "This is a test from Go Mailer via SMTP SSL" | ||
// the rich message body | ||
mail.Body = ` | ||
<h2>Hello from Go Mailer</h2> | ||
<p> | ||
This is a test e-mail from Go Mailer via SMTP SSL | ||
</p> | ||
` | ||
|
||
// multiple recipents | ||
mail.SetTo(recipent) | ||
mail.SetTo(recipent2) | ||
|
||
mailer := NewMailer(host, 465, user, pass, true) | ||
if err := mailer.Send(mail); err != nil { | ||
|