出现的问题:

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

E​x​c​h​a​n​g​e​邮​箱​搭​建的更多相关文章

  1. sed,n,N,d,D,p,P,h,H,g,G,x,解析

    原文地址 这篇文章主要是我参考命令的,直接复制粘贴,有问题请拍砖 A. sed执行模板=sed '模式{命令1;命令2}' 即逐行读入模式空间,执行命令,最后输出打印出来 B. p打印当前模式空间所有 ...

  2. 【转】sed命令n,N,d,D,p,P,h,H,g,G,x解析

    1. sed执行模板=sed '模式{命令1;命令2}' 即逐行读入模式空间,执行命令,最后输出打印出来 2. 为方便下面,先说下p和P,p打印当前模式空间内容,追加到默认输出之后,P打印当前模式空间 ...

  3. sed命令n,N,d,D,p,P,h,H,g,G,x解析

    1.sed执行模板=sed '模式{命令1;命令2}'即逐行读入模式空间,执行命令,最后输出打印出来2.为方便下面,先说下p和P,p打印当前模式空间内容,追加到默认输出之后,P打印当前模式空间开端至\ ...

  4. Sed命令n,N,d,D,p,P,h,H,g,G,x解析3

    摘自:https://blog.csdn.net/WMSOK/article/details/78463199 Sed命令n,N,d,D,p,P,h,H,g,G,x解析 2017年11月06日 23: ...

  5. sed命令n,N,d,D,p,P,h,H,g,G,x解析2

    摘自: https://blog.csdn.net/xiexingshishu/article/details/50514132 sed命令n,N,d,D,p,P,h,H,g,G,x解析 2016年0 ...

  6. g++编译总结

    g++编译&&gdb调试&&coredump调试 一.编译注意细节 1.使用g++编译CPP文件如果用gcc编译C++源文件时,加以下选项:-lstdc++,否则使用了 ...

  7. H.264 White Paper学习笔记(二)帧内预测

    为什么要有帧内预测?因为一般来说,对于一幅图像,相邻的两个像素的亮度和色度值之间经常是比较接近的,也就是颜色是逐渐变化的,不会一下子突变成完全不一样的颜色.而进行视频编码,目的就是利用这个相关性,来进 ...

  8. g++多文件编译

    头文件:A.h void test(); 源文件:A.cpp #include <iostream> #include<thread> #include<chrono&g ...

  9. Educational Codeforces Round 46 (Div 2) (A~G)

    目录 Codeforces 1000 A.Codehorses T-shirts B.Light It Up C.Covered Points Count(差分) D.Yet Another Prob ...

随机推荐

  1. [Xcode 实际操作]七、文件与数据-(6 )通过通知中心,实现监听和处理程序退出事件的功能

    目录:[Swift]Xcode实际操作 本文将演示通过通知中心,实现监听和处理程序退出事件的功能. 在项目导航区,打开视图控制器的代码文件[ViewController.swift] import U ...

  2. python之格式化字符串( format )

    用法: 它通过 { } 和 : 来代替传统 % 方式 1.使用位置参数 要点:从以下例子可以看出位置参数不受顺序约束,且可以为 { }, 只要 format 里有相对应的参数值即可,参数索引从0开,传 ...

  3. MySQL server has gone away和Maximum execution time of 120 seconds exceeded

    今天在写采集时碰到两个问题1.MySQL server has gone away2.Maximum execution time of 120 seconds exceeded 采集程序写好运行大概 ...

  4. Codeforces 1175E(倍增)

    要点 与cf 1168C相似的一点都是看某点x最远能拓展到哪里 看数据想要在logn内查询,考虑倍增步数 const int maxn = 2e5 + 5, X = 5e5 + 5, LOG = 25 ...

  5. Spring注入属性、对象

    对Category和Product注入属性,并且对Product对象,注入一个Category对象 一.新建项目 二.导包 三.新建Category类 package com.yyt.pojo; pu ...

  6. 带你零基础入门redis【一】

    本篇文章介绍在CentOS7系统安装redis,以及redis的简单操作   我们把redis安装在/usr/local目录下.分别执行以下命令 [root@VM_6_102_centos ~]# c ...

  7. js屏蔽鼠标右键事件

    <script type="text/javascript">function stops(){ return false;}document.oncontextmen ...

  8. MySql自动默认时间及更新时间

    注意:5.7 才能用类型为datetime的字段实现 `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `modifie ...

  9. android 内存泄露测试

    Android 程序由java语言编写,android的内存管理与java相似,通过new为对象分配内存,所有对象在java堆内分配空间,对象回收有个垃圾回收器来完成.GC就是垃圾收集的意思(Gaba ...

  10. PostgreSQL数据类型

    http://blog.csdn.net/neo_liu0000/article/category/797059 第六章  数据类型 6.1概述 PostgreSQL 提供了丰富的数据类型.用户可以使 ...