1 回答
TA贡献1796条经验 获得超4个赞
您可以使用+运算符连接字符串:
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 关注
- 178 浏览
添加回答
举报