首页 > 代码库 > golang 发送多人邮件 textproto.Error{Code:554, Msg:"Transaction failed: Illegal semicolon, not in group"
golang 发送多人邮件 textproto.Error{Code:554, Msg:"Transaction failed: Illegal semicolon, not in group"
网上很多版本发送邮件都是用; 号,关键在于,多个邮件分割不能用; 号,需要用,号
// send mailfunc 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))}
golang 发送多人邮件 textproto.Error{Code:554, Msg:"Transaction failed: Illegal semicolon, not in group"
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。