MVC 简单发送邮件示例

没啥好说的 直接上代码

 1 @{
 2         try
 3         {
 4             WebMail.SmtpServer = "smtp.qq.com";//SMTP邮件服务器
 5             WebMail.SmtpPort = 25;//发送端口
 6             WebMail.EnableSsl = true;//启用SSL(GMAIL需要),其他的都不需要
 7             WebMail.UserName = "******";//账户名 
 8             WebMail.Password = "******";//密码
 9             WebMail.From = "******";//邮箱名
10             WebMail.Send("672149336@qq.com","主题","内容");
11         }
12         catch (Exception)
13         {
14         @:<b>Sorry - 发送失败</b>
15         }
16     }
原文地址:https://www.cnblogs.com/yrup/p/4226151.html