Skip to content

Commit f5e5bbd

Browse files
committed
Updated the examples
1 parent b986486 commit f5e5bbd

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

examples/examples.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Package main is examples using the go-mail package
44
package main
55

66
import (
7+
"context"
78
"log"
89
"os"
910
"strconv"
@@ -71,7 +72,7 @@ func awsSesExample() {
7172
email.Subject = "example go-mail email using AWS SES"
7273

7374
// Send the email
74-
if err = mail.SendEmail(email, provider); err != nil {
75+
if err = mail.SendEmail(context.Background(), email, provider); err != nil {
7576
log.Fatalf("error in SendEmail: %s using provider: %x", err.Error(), provider)
7677
}
7778
log.Printf("email sent!")
@@ -115,7 +116,7 @@ func mandrillExample() {
115116
email.Subject = "example go-mail email using Mandrill"
116117

117118
// Send the email
118-
if err = mail.SendEmail(email, provider); err != nil {
119+
if err = mail.SendEmail(context.Background(), email, provider); err != nil {
119120
log.Fatalf("error in SendEmail: %s using provider: %x", err.Error(), provider)
120121
}
121122
log.Printf("email sent!")
@@ -159,7 +160,7 @@ func postmarkExample() {
159160
email.Subject = "example go-mail email using Postmark"
160161

161162
// Send the email
162-
if err = mail.SendEmail(email, provider); err != nil {
163+
if err = mail.SendEmail(context.Background(), email, provider); err != nil {
163164
log.Fatalf("error in SendEmail: %s using provider: %x", err.Error(), provider)
164165
}
165166
log.Printf("email sent!")
@@ -212,7 +213,7 @@ func smtpExample() {
212213
email.Subject = "example go-mail email using SMTP"
213214

214215
// Send the email
215-
if err = mail.SendEmail(email, provider); err != nil {
216+
if err = mail.SendEmail(context.Background(), email, provider); err != nil {
216217
log.Fatalf("error in SendEmail: %s using provider: %x", err.Error(), provider)
217218
}
218219
log.Printf("email sent!")
@@ -279,7 +280,7 @@ func allOptionsExample() {
279280
}
280281

281282
// Send the email (basic example using one provider)
282-
if err = mail.SendEmail(email, provider); err != nil {
283+
if err = mail.SendEmail(context.Background(), email, provider); err != nil {
283284
log.Fatalf("error in SendEmail: %s using provider: %x", err.Error(), provider)
284285
}
285286

0 commit comments

Comments
 (0)