出现的问题:

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. 3DMAX可编辑多边形常用命令-桥

    桥命令可以连接连个面 下图两个cube(可编辑多边形)已经被附加到一起,选中相对的两个面,点击桥 结果

  2. Linux下查看磁盘剩余空间和文件夹大小

    1. du -sh 查看当前文件夹大小 2. du -sh * | sort -n 列出当前文件夹下的所有文件夹及其大小,并按照文件夹大小排序 du - sh *  //查看当前文件夹下所有文件的大小 ...

  3. C# ExpandoObject用法

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...

  4. CodeForces - 851B -Arpa and an exam about geometry(计算几何)

    Arpa is taking a geometry exam. Here is the last problem of the exam. You are given three points a,  ...

  5. python大战机器学习——支持向量机

    支持向量机(Support Vector Machine,SVM)的基本模型是定义在特征空间上间隔最大的线性分类器.它是一种二类分类模型,当采用了核技巧之后,支持向量机可以用于非线性分类. 1)线性可 ...

  6. css中如何设置透明度

    怎样在CSS样式中设置背景的透明度,下面一个具体的实例.把类为box的层设为透明.<div class="box"></div><style>. ...

  7. Codeforces Round #375 (Div. 2) D. Lakes in Berland 并查集

    http://codeforces.com/contest/723/problem/D 这题是只能把小河填了,题目那里有写,其实如果读懂题这题是挺简单的,预处理出每一块的大小,排好序,从小到大填就行了 ...

  8. Java编码优化

    Java编码优化 1.尽可能使用局部变量 调用方法时传递的参数以及在调用中创建的临时变量都保存在栈中速度较快,其他变 量,如静态变量.实例变量等,都在堆中创建,速度较慢.另外,栈中创建的变量,随 着方 ...

  9. 洛谷P1781 宇宙总统

    https://www.luogu.org/problem/show?pid=1781 高精比较大小: #include<iostream> #include<cstdio> ...

  10. Unity使用 转载

    创建空的ASP.NET MVC3项目,添加对Unity2.0动态库的引用. 方法1:在MSDN上下载Untity2.0,安装后,默认安装在C:\Program Files\Microsoft Unit ...