如何解决从网站发送的电子邮件中的可疑链接错误

时间:2019-01-22 19:53:28

标签: email go https smtp gsuite

我正在从我的Go RESTFUL网络服务向我们的用户发送重置密码电子邮件,并且我正在使用go SMTP和Google Gsuite域info@mycompanyname.ca!我之前已经对其进行了测试,并且可以工作,但是当我将其发送给我们的一位用户时,他会收到Suspicious Link错误。他正在使用Gmail网站。我检查了https,我的网站和链接均为https,当他将电子邮件转发给我时,我不再看到此错误!有人可以帮我吗?

这是我的代码:

        mime string = "MIME-version: 1.0;\nContent-Type: text/html; 
        charset=\"UTF-8\";\n\n"
        hostname string = "smtp.gmail.com"

        auth := smtp.PlainAuth("", username, password, hostname)

        data := map[string]string{"Token": token}
        buffer := new(bytes.Buffer)

        t, err := template.ParseFiles(htmlFilename)
        if err != nil {
                return err 
        }   

        err = t.Execute(buffer, data)
        if err != nil {
                return err 
        }   

        msg := []byte(subject + mime + buffer.String())
        reciever = append(reciever, clientMail)

        return smtp.SendMail(hostname+":587", auth, "", reciever, msg)
}

这是HTML:

  <!DOCTYPE html>
    <html lang="en">
    <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1.0, shrink-to-fit=no" name="viewport">
    <meta name="author" content="some name">
    <meta name="description" content="Entry HTML page for the dashboard">
    </head>
    <body style="max-width: 50rem; margin: auto; margin-top: 1rem;">
    <img src="https://address in google drive" style="margin:auto;
    display: block; width: 17rem; height: 4.6rem; position: relative; left: 50%; transform: translateX(-50%);"
    alt="logo" title="company logo" />
    <div style="margin-top: 0.5rem; padding-left: 0.5rem; padding-right: 0.5rem; border-top: 1px solid lightgray;
    border-bottom: 1px solid lightgray; background-color: #f9f9f9">
    <h3>Hello!</h3>
    <p>You receive this email because this is your first time logging in. To enter your account,
    you will need to set a password. Click the button below to set it.</p>
    <div style="text-align: center">
    <a href="https://websiteAddress/#/changepasswordapi?token={{ .Token }}" target="_blank">
    <button style="cursor: pointer; border: none; width: 50%; background-color: #ED5E28;
    color: white; font-size: 1rem; height: 2.5rem;
    border-radius: 0.35rem"><strong>Set Password</strong></button>
    </a>
    </div>
    <p>If you didn't request this, please ignore this email. The password setup is only valid for the next 24 hours.</p>
    <p>Thanks,</p>
    <p>compaynName Team</p>
    </div>
    <div style="text-align: center; font-size: 0.8rem; color: gray">
    <p>&copy; 2019 companyName. All rights reserved.</p>
    <p>company addr</p>
    <P>company city</P>
    </div>
    </body>
    </html>

1 个答案:

答案 0 :(得分:0)

好的,我解决了这个问题。起初,我以为可能是G Suite问题,所以我给他们打电话了,我意识到这不是因为我可以在收件箱而不是垃圾邮件文件夹中看到我们的电子邮件。因此,我尝试了this link,并要求对我们的域进行审核。大约30小时后,问题消失了!