Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions email_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -931,3 +931,24 @@ func TestParseSender(t *testing.T) {
}
}
}

func TestSendEmail(t *testing.T) {
input := &Email{
From: "example_from@gmail.com",
To: []string{"example_to@gmail.com"},
Subject: "Test Subject",
Text: []byte("This is a test email with HTML Formatting. It also has very long lines so\nthat the content must be wrapped if using quoted-printable decoding.\n"),
HTML: []byte("<div dir=\"ltr\">This is a test email with <b>HTML Formatting.</b>\u00a0It also has very long lines so that the content must be wrapped if using quoted-printable decoding.</div>\n"),
}

err := input.Send("smtp.gmail.com:587", smtp.PlainAuth("", input.From, "password123", "smtp.gmail.com"))
if err == nil {
t.Fatalf("Error expected when sending email")
}

err = input.Send("smtp.gmail.com:587", smtp.PlainAuth("", input.From, "password123", "smtp.gmail.com"))
if err == nil {
t.Fatalf("Error expected when sending email")
}

}