123456789101112131415161718192021222324 |
- package main
- import (
- "log"
- "github.com/wneessen/go-mail"
- )
- func main() {
- message := mail.NewMsg()
- message.From("no-reply@byom.fr")
- message.To("vollivier@gmail.com")
- message.Subject("This is my first test mail with go-mail!")
- message.SetBodyString(mail.TypeTextPlain, "This will be the content of the mail.")
- message.ReplyTo("no-reply@byom.fr")
- // Deliver the mails via SMTP
- client, _ := mail.NewClient("ssl0.ovh.net",
- mail.WithSMTPAuth(mail.SMTPAuthPlain), mail.WithTLSPortPolicy(mail.DefaultTLSPolicy),
- mail.WithUsername("apps@byom.fr"), mail.WithPassword(""),
- )
- client.DialAndSend(message)
- log.Printf("Test mail successfully delivered.")
- }
|