我在代码文件中编写了以下代码。但它不起作用...请帮助我! :)
protected void Button1_Click(object sender, EventArgs e)
{
MailMessage msgeme = new MailMessage("[email protected] /cdn-cgi/l/email-protection", "[email protected] /cdn-cgi/l/email-protection", "subject", "body");
SmtpClient smtpclient = new SmtpClient("smtp.gmail.com",587);
smtpclient.EnableSsl = true;
smtpclient.Send(msgeme);
smtpclient.Credentials = new NetworkCredential("[email protected] /cdn-cgi/l/email-protection", "password");
}
我尝试了 587 和 465。Bt 它显示 SMTP 异常处理程序错误。有人可以帮忙吗???
您需要在调用发送方法之前设置您的凭据。
不过,有关该错误的更多信息会有所帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)