1 回答

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超4個(gè)贊
您可以使用+運(yùn)算符連接字符串:
id = "122"
m := gomail.NewMessage()
m.SetHeader("From", "example@gmail.com")
m.SetHeader("To", email)
m.SetHeader("Subject", "Paasword Reset for Kibbcom India")
m.SetBody("text/html", "Hi! <br> Please click on <a href = 'https://onboarding.kibbcom.in/forgotpassword?emp="+id+"'>https://onboarding.kibbcom.in/forgotpassword</a>")
您還可以使用該fmt包來插入字符串:
id = "122"
m := gomail.NewMessage()
m.SetHeader("From", "example@gmail.com")
m.SetHeader("To", email)
m.SetHeader("Subject", "Paasword Reset for Kibbcom India")
m.SetBody("text/html", fmt.Sprintf("Hi! <br> Please click on <a href = 'https://onboarding.kibbcom.in/forgotpassword?emp=%s'>https://onboarding.kibbcom.in/forgotpassword</a>", id))
https://play.golang.org/p/BpxJ5XJprmo
- 1 回答
- 0 關(guān)注
- 208 瀏覽
添加回答
舉報(bào)