2017-10-10 149 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) 
    } 
} 

回答

相關問題