如何使用gomail设置回复邮件地址
How to set reply-to email address using gomail
我正在尝试使用 gomail
发送电子邮件,需要设置回复电子邮件地址。搜索了很多但没有得到任何相关的 link.
package main
import "gopkg.in/gomail.v2"
func main() {
m := gomail.NewMessage()
m.SetAddressHeader("From", "sender@example.com", "Sandy Sender")
m.SetAddressHeader("To", "recipient@example.com")
m.SetHeader("Subject", "Hello!")
m.SetBody("text/plain", "This is the body of the message.")
d := gomail.NewPlainDialer("smtp.example.com", 587, "user", "123456")
if err := d.DialAndSend(m); err != nil {
panic(err)
}
}
您可以设置 Reply-To
header 效果:
m.SetAddressHeader("Reply-To", "noreply@example.com")
我正在尝试使用 gomail
发送电子邮件,需要设置回复电子邮件地址。搜索了很多但没有得到任何相关的 link.
package main
import "gopkg.in/gomail.v2"
func main() {
m := gomail.NewMessage()
m.SetAddressHeader("From", "sender@example.com", "Sandy Sender")
m.SetAddressHeader("To", "recipient@example.com")
m.SetHeader("Subject", "Hello!")
m.SetBody("text/plain", "This is the body of the message.")
d := gomail.NewPlainDialer("smtp.example.com", 587, "user", "123456")
if err := d.DialAndSend(m); err != nil {
panic(err)
}
}
您可以设置 Reply-To
header 效果:
m.SetAddressHeader("Reply-To", "noreply@example.com")