You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
s := gomail.SendFunc(func(from string, to []string, msg io.WriterTo) error {
// Implements you email-sending function, for example by calling
// an API, or running postfix, etc.
fmt.Println("From:", from)
fmt.Println("To:", to)
return nil
})
Your gomail.SendFunc basically only prints out the "From" and "To" fields of the mail but does not perform any sending operation. You followed the "No SMTP" example which basically means it does not send the mail via SMTP and leaves it up to you to write your own delivery function. Why did you chose this example when you are expecting to send mails?
Hi @alexcesaro , I followed the guide from our documentation but don't receive any email. Even no error throw from the log.
m := gomail.NewMessage()
m.SetHeader("From", "from@example.com")
m.SetHeader("To", "to@example.com")
m.SetHeader("Subject", "Hello!")
m.SetBody("text/plain", "Hello!")
s := gomail.SendFunc(func(from string, to []string, msg io.WriterTo) error {
// Implements you email-sending function, for example by calling
// an API, or running postfix, etc.
fmt.Println("From:", from)
fmt.Println("To:", to)
return nil
})
if err := gomail.Send(s, m); err != nil {
panic(err)
}
The text was updated successfully, but these errors were encountered: