使用需要验证的邮件服务器发送邮件的方法
2004-04-14 09:36
495 查看
开心就好的blog居然真的说删就删了,损失了,好多资料还想看呢。还好以前备份了几篇,转贴一下吧。可见转贴也是很有价值的,至少丢了一个还能找到另一个
以下转贴:
在.NET Framework 推出以后,大家一直在为这个问题而伤脑筋。的确,在1.0的时候,我们是不能实现此方案的,大部分人选择了使用Socket底层自己重写。但是,在1.1的时候,其实Microsoft已经提供了验证功能了,只是一直没有公开。
恰好我在读.Text 0.95的源代码的时候找到了这段代码,感觉应该提供给大家
private void Page_Load(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret"); //set your password here
SmtpMail.SmtpServer = "mail.mycompany.com"; //your real server goes here
SmtpMail.Send( mail );
}
http://www.systemwebmail.com/faq/3.8.aspx
以下转贴:
在.NET Framework 推出以后,大家一直在为这个问题而伤脑筋。的确,在1.0的时候,我们是不能实现此方案的,大部分人选择了使用Socket底层自己重写。但是,在1.1的时候,其实Microsoft已经提供了验证功能了,只是一直没有公开。
恰好我在读.Text 0.95的源代码的时候找到了这段代码,感觉应该提供给大家
private void Page_Load(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret"); //set your password here
SmtpMail.SmtpServer = "mail.mycompany.com"; //your real server goes here
SmtpMail.Send( mail );
}
http://www.systemwebmail.com/faq/3.8.aspx
相关文章推荐
- 使用System.Web.Mail通过需验证的邮件服务器发送邮件
- 使用System.Web.Mail通过需验证的邮件服务器发送邮件
- ASP下使用CDO.Message实现需要身份验证的邮件发送
- 使用System.Web.Mail通过需验证的邮件服务器发送邮件
- 使用System.Web.Mail通过需验证的邮件服务器发送邮件(转)
- 使用System.Web.Mail通过需验证的邮件服务器发送邮件
- 使用System.Web.Mail通过需验证的邮件服务器发送邮件
- 使用需要验证用户的smtp服务器发送邮件
- 如何通过需要验证的邮件服务器发送邮件?
- 使用System.Web.Mail通过需验证的邮件服务器发送邮件
- 如何通过需要验证的邮件服务器发送邮件?
- 如何通过需要验证的邮件服务器发送邮件?
- 在Asp.Net中使用SmtpMail发送邮件的方法
- 使用system.web.mail.SMTPmail发送邮件,处理smtp验证问题
- 在Asp.Net中使用SmtpMail发送邮件的方法:实例
- 《pro Spring》学习笔记之使用Sprin+James邮件服务器发送复杂类型邮件
- 《pro Spring》学习笔记之使用Spring+James邮件服务器发送普通文本邮件
- 《pro Spring》学习笔记之使用Spring+James邮件服务器发送内嵌图片的HTML邮件
- 《pro Spring》学习笔记之使用Velocity+Spring+James邮件服务器发送邮件
- 三种使用SMTP协议发送邮件的方法