2017-10-10 147 views
2

我想用gomail发送电子邮件,需要设置回复电子邮件地址。搜索了很多,但没有得到任何相关的链接。如何使用gomail设置回复电子邮件地址

package main 

import "gopkg.in/gomail.v2" 

func main() { 
    m := gomail.NewMessage() 
    m.SetAddressHeader("From", "[email protected]", "Sandy Sender") 
    m.SetAddressHeader("To", "[email protected]") 
    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) 
    } 
} 

回答

相关问题