asp.net mvc 发送邮箱验证码
2015-11-12 16:43
731 查看
public ActionResult Index() { /*第一种,利用Google的smtp来发送邮件*/ SmtpClient client = new SmtpClient("smtp.163.com", 25); Random Rdm = new Random(); //产生0到100的随机数 int iRdm = Rdm.Next(99999, 100000); MailMessage msg = new MailMessage("邮箱@163.com", "接收的邮箱", "验证码", iRdm.ToString()); client.UseDefaultCredentials = false; System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential("163邮箱注册的账号", "163邮箱注册的密码"); client.Credentials = basicAuthenticationInfo; client.EnableSsl = true; client.Send(msg); return Content("s"); }
要发送邮箱,首先要在163邮箱注册一个账号,用这个账号就可以发邮箱了。。
相关文章推荐
- asp.net请求管道和页面生命周期
- asp.net日期格式出现"/"的问题
- iOS设置按钮的图片为Aspetfit
- asp.net发布webservice出现‘Could not write to output file ‘解决办法
- asp.net微信开发(开发者接入)
- ASP.NET MVC 网站优化总结 使用 Gzip 压缩
- 实现在ASP中对字符的Escape编码和解码
- 智能家居喂鱼系统(二)-器材介绍
- URLRewrite伪静态后AspNetPager分页控件列表输出的静态化方法
- ASP.NET 弹出提示框所有种类
- ASP.NET中的DataView用法详解
- ASP.NET MVC 4 中的JSON数据交互
- NoClassDefFoundError: org/aspectj/lang/JoinPoint
- ASP.NET MVC- 使用PageList.Mvc分页
- Asp.net MVC中传递ViewData数据不能正确传递的问题
- asp.net微信开发(开发者接入)
- ASP.NET MVC - Display UTC time from server as local time on client side
- WPF/ASP.NET:几个Prism中的术语
- Asp.Net网站部署-上传文件限制解决方案
- ASP.NET Web API 2基于令牌的身份验证