golang 发送多人邮件 textproto.Error{Code:554, Msg:"Transaction failed: Illegal semicolon, not in group"
网上很多版本发送邮件都是用; 号,关键在于,多个邮件分割不能用; 号,需要用,号
// send mail func SendMail(subject string, message string, from *mail.Address, to []string, smtpConfig SmtpConfig, isHtml bool) error { auth := smtp.PlainAuth( "", smtpConfig.Username, smtpConfig.Password, smtpConfig.Host, ) contentType := "text/plain" if isHtml { contentType = "text/html" } msg := fmt.Sprintf("To: %s\r\nFrom: %s\r\nSubject: %s\r\nContent-Type: %s; charset=UTF-8\r\n\r\n%s", strings.Join(to, ","), from.String(), subject, contentType, message) return smtp.SendMail(smtpConfig.Addr, auth, from.Address, to, []byte(msg)) }
本文来自:博客园
感谢作者:zhangqingping
查看原文:golang 发送多人邮件 textproto.Error{Code:554, Msg:"Transaction failed: Illegal semicolon, not in group"
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。