Asp.net mvc 4 MVC4电子邮件发送

Asp.net mvc 4 MVC4电子邮件发送,asp.net-mvc-4,smtp,Asp.net Mvc 4,Smtp,我正在尝试用电子邮件恢复密码。我正在使用WebMail.Send函数,但它以超时结束,我不知道为什么 WebMail.SmtpServer = "smtp.gmail.com"; WebMail.SmtpPort = 465; WebMail.Send(to:email, subject:"Password Reset", body:"Your password reset token is <a href=\"" + confirmationUrl + "\">"

我正在尝试用电子邮件恢复密码。我正在使用WebMail.Send函数,但它以超时结束,我不知道为什么

WebMail.SmtpServer = "smtp.gmail.com";
WebMail.SmtpPort = 465;
WebMail.Send(to:email, subject:"Password Reset", body:"Your password reset token is <a          href=\"" + confirmationUrl + "\">" +token+ " </a> please visit " + confirmationUrl );
WebMail.SmtpServer=“smtp.gmail.com”;
WebMail.SmtpPort=465;
发送(收件人:电子邮件,主题:“密码重置”,正文:“您的密码重置令牌为请访问”+确认URL);

WebMail.UserName和WebMail.Password也已设置

Gmail SMTP端口为25(SSL)或587(TLS),请尝试使用其中一个端口。465(SSL)有时可能会出现问题。

这有助于我猜,现在我得到了“5.7.0必须先发出STARTTLS命令。”