/**//// <summary>
/// 注册时发送用户帐号跟密码
/// </summary>
/// <param name="receiver">用户注册邮箱</param>
/// <param name="username">用户名</param>
/// <param name="password">用户密码明文</param>
public bool Register(string receiver, string username, string password)
...{
//System.Net.Mail.SmtpClient mail = new System.Net.Mail.SmtpClient();
//邮件发送时请确认服务的杀毒软件因素
System.Net.Mail.SmtpClient client;
client = new System.Net.Mail.SmtpClient("smtp.163.com");
client.Timeout = 60000;
//client.UseDefaultCredentials = false;
client.UseDefaultCredentials = true;
client.Credentials = new System.Net.NetworkCredential("abc@163.com", "123456");
client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.SubjectEncoding = System.Text.Encoding.UTF8;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.From = new System.Net.Mail.MailAddress("abc@163.com", "Andy Lu", System.Text.Encoding.UTF8);
message.To.Add(new System.Net.Mail.MailAddress(receiver, username, System.Text.Encoding.UTF8));
message.IsBodyHtml = false;
message.Subject = "用户注册信息(软件项目网)";
message.Body = username + ":您好! 欢迎您光临软件项目网[http://www.softprj.cn]!您注册的用户名是:" + username + ";密码是:" + password + "。 点此进入软件项目网:http://www.soft.cn";
try
...{
client.Send(message);
return true;
}
catch
...{
return false;
}
}
看了无数篇,检查了N次,原来是VirusScan 惹得祸!
关掉其“按访问扫描”一切OK
参考此篇http://blog.csdn.net/mengyao/archive/2007/08/16/1745836.aspx
转自:http://blog.csdn.net/mengyao/archive/2007/08/15/1743427.aspx
分享到:
相关推荐
ASP.Net使用jmail和System.Net.Mail发送邮件
System.Net.Http.dll下载
编译后可在bin下面生成System.Net.FtpClient.dll,用于C#在ftp上传时调用。
System.Net.Http.Formatting 4.0各版本,asp.net C#.net 都能用到
绝大部分异常信息为:System.Net.WebException: The operation has timed out,即网络操作超时的异常
System.Net.Http.Formatting.dll
C#的FTP操作类库,支持FTP文件的上传,下载等等,封装好的可直接引用FtpClient; 如果自己单枪匹马写一个连接ftp服务器代码那是相当恐怖的...那就是System.Net.FtpClient,链接地址:https://netftp.codeplex.com
C#使用HttpClient需要 using System.Net.Http; 但是Windows系统里面好像又没有自带相应的dll文件,这是这个命名空间的System.Net.Http.dll。 编译的时候 csc /r:System.Net.Http.dll HttpClientTest.cs 这样使用。
System.Net.Http.Formatting.xml
system.net.mail,winform发送邮件,webform发送邮件,邮件发送
System.Net.Json System.Net.Json
system.net.http.dll文件 2016 版本2.2.22.0 186K DDL文件
含 各个版本,引用此DLL可解决C#HttpClient的不支持PostAsJsonAsync方法的问题
解决火车头7.6网站报错System.Net.HttpWebRequest问题的处理 插件 无限制。 https.dll 永久使用无限制版本https
System.Net.Http.Formatting
System.Net.Http.rar
System.Net.Http 是微软推出的最新的 HTTP 应用程序的编程接口, 微软称之为“现代化的 HTTP 编程接口”
我拿了个sina.com的邮箱进行测试,也需要在后台里面的才可以发送。详细代码如下: 代码如下:MailAddress from = new MailAddress(“sosuo8@sina.com”); MailAddress to = new MailAddress(“ahuinan@21cn.com”); ...
主要为大家详细介绍了ASP.NET邮件发送system.Net.Mail案例,具有一定的参考价值,感兴趣的小伙伴们可以参考一下