将地址发回 POST 方法。我想向该地址发送电子邮件:
[HttpPost, ActionName("Index")]
public ActionResult IndexPOST(SuppliersIndexVM allSuppliers)
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("martin.lagan@umac-solutions.co.uk");
mail.To.Add("martin.lagan@umac-solutions.co.uk");
mail.Subject = "Order";
mail.Body = "I would like to order the following...";
SmtpServer.Send(mail);
return RedirectToAction("Index");
}
错误来自最后一行:SmptpServer.Sed(mail)...
SMTP 服务器需要安全连接或客户端未通过身份验证。服务器响应是: 5.7.0 必须首先发出 STARTTLS 命令。b20sm10938791wiw.4 - gsmtp
任何想法,伙计们......还有我如何在我发送的电子邮件中添加表格等......干杯