Skip to content

Commit

Permalink
Updated the examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Oct 27, 2022
1 parent b986486 commit f5e5bbd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions examples/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Package main is examples using the go-mail package
package main

import (
"context"
"log"
"os"
"strconv"
Expand Down Expand Up @@ -71,7 +72,7 @@ func awsSesExample() {
email.Subject = "example go-mail email using AWS SES"

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

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

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

// Send the email
if err = mail.SendEmail(email, provider); err != nil {
if err = mail.SendEmail(context.Background(), email, provider); err != nil {
log.Fatalf("error in SendEmail: %s using provider: %x", err.Error(), provider)
}
log.Printf("email sent!")
Expand Down Expand Up @@ -279,7 +280,7 @@ func allOptionsExample() {
}

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

Expand Down

0 comments on commit f5e5bbd

Please sign in to comment.