Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not receiving email when sending email as No SMTP. #181

Open
StevenOng97 opened this issue Apr 12, 2023 · 1 comment
Open

Not receiving email when sending email as No SMTP. #181

StevenOng97 opened this issue Apr 12, 2023 · 1 comment

Comments

@StevenOng97
Copy link

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)
}

@wneessen
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants