fix
This commit is contained in:
parent
0a748dfab7
commit
8e95bfb987
|
@ -222,6 +222,7 @@ func RenderEmailTemplate(templateName, companyName, confirmationLink, senderName
|
||||||
}
|
}
|
||||||
|
|
||||||
var result bytes.Buffer
|
var result bytes.Buffer
|
||||||
|
result.Write([]byte("MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n"))
|
||||||
err := tpls.ExecuteTemplate(&result, templateName, data)
|
err := tpls.ExecuteTemplate(&result, templateName, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
|
@ -28,97 +28,13 @@ func TestEmailSend(t *testing.T) {
|
||||||
|
|
||||||
auth := smtp.PlainAuth("", "support@fusenpack.com", "wfbjpdgvaozjvwah", smtpServer)
|
auth := smtp.PlainAuth("", "support@fusenpack.com", "wfbjpdgvaozjvwah", smtpServer)
|
||||||
|
|
||||||
body := `<div>
|
subject := "Subject: Test email from Go!\n"
|
||||||
<br>
|
mime := "MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n"
|
||||||
</div>
|
body := "<html><body><h1>Hello World!</h1></body></html>"
|
||||||
<div>
|
msg := []byte(subject + mime + body)
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<sign signid="1" nreadytime="1693908994426">
|
|
||||||
<hr align="left" style="margin: 0 0 10px 0;border: 0;border-bottom:1px solid #E4E5E6;height:0;line-height:0;font-size:0;padding: 20px 0 0 0;width: 50px;">
|
|
||||||
<div style="font-size:14px;font-family:Verdana;color:#000;">
|
|
||||||
<a class="xm_write_card" id="in_alias" style="white-space: normal; display: inline-block; text-decoration: none !important;font-family: -apple-system,BlinkMacSystemFont,PingFang SC,Microsoft YaHei;" href="https://wx.mail.qq.com/home/index?t=readmail_businesscard_midpage&nocheck=true&name=3e&icon=http%3A%2F%2Fthirdqq.qlogo.cn%2Fg%3Fb%3Doidb%26k%3DeXzYkarOrzZhXZpDqM83lA%26kti%3DZOJARgAAAAI%26s%3D140%26t%3D1556039949&mail=474420502%40qq.com&code=WmPZN_MDFxAnvpYZtHjQqsJv-zHkDdwEwftrVq-KClPFKtdQ71RDiVxIOZ7rrthFIT9ubnRFwkPjfKb3swLDIQ" target="_blank">
|
|
||||||
<table style="white-space: normal;table-layout: fixed; padding-right: 20px;" contenteditable="false" cellpadding="0" cellspacing="0">
|
|
||||||
<tbody>
|
|
||||||
<tr valign="top">
|
|
||||||
<td style="width: 40px;min-width: 40px; padding-top:10px">
|
|
||||||
<div style="width: 38px; height: 38px; border: 1px #FFF solid; border-radius:50%; margin: 0;vertical-align: top;box-shadow: 0 0 10px 0 rgba(127,152,178,0.14);">
|
|
||||||
<img src="http://thirdqq.qlogo.cn/g?b=oidb&k=eXzYkarOrzZhXZpDqM83lA&kti=ZOJARgAAAAI&s=140&t=1556039949" style="width:100%;height:100%;border-radius:50%;pointer-events: none;">
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td style="padding: 10px 0 8px 10px;">
|
|
||||||
<div class="businessCard_name" style="font-size: 14px;color: #33312E;line-height: 20px; padding-bottom: 2px; margin:0;font-weight: 500;">
|
|
||||||
3e
|
|
||||||
</div>
|
|
||||||
<div class="businessCard_mail" style="font-size: 12px;color: #999896;line-height: 18px; margin:0;">
|
|
||||||
474420502@qq.com
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</sign>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div style="position: relative;">
|
|
||||||
<includetail>
|
|
||||||
<div>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
<div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">
|
|
||||||
------------------ 原始邮件 ------------------
|
|
||||||
</div>
|
|
||||||
<div style="font-size: 12px;background:#efefef;padding:8px;">
|
|
||||||
<div>
|
|
||||||
<b>
|
|
||||||
发件人:
|
|
||||||
</b>
|
|
||||||
"support" <support@fusenpack.com>;
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<b>
|
|
||||||
发送时间:
|
|
||||||
</b>
|
|
||||||
2023年9月5日(星期二) 晚上6:16
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<b>
|
|
||||||
收件人:
|
|
||||||
</b>
|
|
||||||
"3e"<474420502@qq.com>;
|
|
||||||
<wbr>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<b>
|
|
||||||
主题:
|
|
||||||
</b>
|
|
||||||
Simple Mail
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</includetail>
|
|
||||||
</div>`
|
|
||||||
// 构建邮件内容
|
|
||||||
message := []byte("To: " + to[0] + "\r\n" +
|
|
||||||
"Subject: Simple Mail\r\n" +
|
|
||||||
"\r\n" +
|
|
||||||
body)
|
|
||||||
|
|
||||||
// 发送邮件
|
// 发送邮件
|
||||||
err := smtp.SendMail(smtpServer+":587", auth, from, to, message)
|
err := smtp.SendMail(smtpServer+":587", auth, from, to, msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user