出现的问题:

System.Runtime.InteropServices.COMException(0x8004020F): The server rejected one or more recipient addresses.

这个问题
需要设置可以通过指定邮件服务器进行relay的ip地址

smtp->properties->access->relay
add the ip address

 public bool Send(string to, string from, string subject, string message)
{
try
{
MailMessage em = new MailMessage();
em.To = to;
em.From = from;
em.Subject = subject;
em.Body = message; //Found out how to send authenticated email via System.Web.Mail at http://SystemWebMail.com (fact 3.8)
if(this.UserName != null && this.Password != null)
{
em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", this.UserName); //set your username here
em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", this.Password); //set your password here
} SmtpMail.SmtpServer = this.SmtpServer;
SmtpMail.Send(em);
return true;
}
catch
{
return false;
}
} }
}

E​x​c​h​a​n​g​e​邮​箱​搭​建:

http://wenku.baidu.com/link?url=PBI6WseFEs8dQCjEAcmzmMZ6VdXmQ44RcvVl9BR8b5rtzsVBbJEX1AcV8VwwSH49rcy9KB7_I5Xgia5EmkqlbUcSbO_qLIzmRJwACKmmlPO

最新文章

  1. 夺命雷公狗----Git---7---GitHub当仓库本地使用(完)
  2. photoshop cs5 key
  3. Log4Net配置以及使用
  4. 关于oracle ORA-28001的解决方法
  5. TNS-12541: TNS: 无监听程序 TNS-12560: TNS: 协议适配器错误 TNS-00511: 无监听程序
  6. thinkphp框架中session常识
  7. MySQL出现大量unauthenticated user的问题
  8. demo06
  9. 1037: [ZJOI2008]生日聚会Party - BZOJ
  10. 基于ArcGIS的栅格图像平滑处理(转)
  11. rhel5.8 ISO yum源配置
  12. 【转】Directx11 HelloWorld之HLSL的Effect框架的使用
  13. Struts2 拦截器—拦截action
  14. 理解java容器:iterator与collection,容器的起源
  15. .NET基础之this关键字
  16. 21.react 组件通信
  17. 树莓派motion监控安装配置相关事情
  18. aaronyang的百度地图API之LBS云与.NET开发 Javascript API 2.0【基本地图的操作】
  19. [转]如何禁止 IIS 在 C:\Windows\System32\LogFiles\HTTPERR 中生成日志文件
  20. Thunder团队--Alpha发布用户报告

热门文章

  1. 利用外部协议让chrome启动外部应用程序
  2. poj 2769 感觉♂良好 (单调栈)
  3. 洛谷P2647 最大收益
  4. 十、正则表达式和JSON
  5. PJzhang:子域名爆破工具wydomain(猪猪侠)
  6. Java代码读取文件
  7. ELK系列(1) - Elasticsearch + Logstash + Kibana + Log4j2快速入门与搭建用例
  8. C# 数组之ArrayList
  9. SSIS父子维度
  10. 重置 linux系统后要配置的基本组件操作