Send Mail using C# code
using System.Net.Mail;
public class MailHelp
{
public static void Send(string subject, string body)
{
MailMessage message = new MailMessage();
SmtpClient client = new SmtpClient();
client.Port = ;
client.Host = "smtphost.mycompany.com";
client.Timeout = ;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("user", "pwd","domain");
message.From = new MailAddress("from@server.com");
message.To.Add(new MailAddress("to@server.com"));
message.CC.Add(new MailAddress("cc@server.com"));
message.Subject = subject;
message.Body = body;
client.Send(message);
}
}
Send Mail using C# code的更多相关文章
- SSIS Send Mail
在SSIS中Send Mail的方法主要有三种,使用Send Mail Task,使用Script Task和使用存储过程msdb.dbo.sp_send_dbmail. 一,使用Send Mail ...
- mailsend - Send mail via SMTP protocol from command line
Introduction mailsend is a simple command line program to send mail via SMTP protocol. I used to sen ...
- 发送邮件的三种方式:Send Mail Message
发送邮件的三种方式: 1.VBS 执行vbs脚本文件的程序为: system32文件下的 NameSpace = "http://schemas.microsoft.com/cdo/conf ...
- How to attach multiple files in the Send Mail Task in SSIS
Let’s say you need to create a SSIS package that creates 2 files and emails the files to someone. Yo ...
- Python 3.4 send mail
#coding=utf-8 #Python 3.4 https://docs.python.org/3.4/library/ #IDE:Visual Studio 2015 Window10 impo ...
- golang:send mail using smtp package
go语言发送邮件,可以使用smtp包,两个关键函数: func PlainAuth(identity, username, password, host string) Auth func SendM ...
- python trojan development 1st —— use python to send mail and caputre the screen then combine them
import smtplib from email.mime.text import MIMEText msg_from='1@qq.com' #发送方邮箱 passwd='bd' #填入发送方邮箱的 ...
- C# send mail with outlook and word mailmerge
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.document_members(v=office.15). ...
- Send Mail 网址
http://www.codeproject.com/Tips/371417/Send-Mail-Contact-Form-using-ASP-NET-and-Csharp http://www.c- ...
随机推荐
- 20145236 《Java程序设计》实验四实验报告
20145236 实验四 Android开发基础 实验内容: 1.基于Android Studio开发简单的Android应用并部署测试; 2.了解Android组件.布局管理器的使用: 3.掌握An ...
- 452. Minimum Number of Arrows to Burst Balloons——排序+贪心算法
There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided ...
- ajax简单封装
var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); ...
- BZOJ4000 [TJOI2015]棋盘
首先是状态压缩DP... 然后我们发现转移都是一样的...可以矩阵优化... 于是做完啦QAQQQ 题目读不懂?恩多读几遍就读懂了,诶诶诶!别打我呀! /*********************** ...
- routeProvider
In a previous post about testing I mentioned that route resolves can make authoring unit tests for a ...
- JavaScript自定义右键菜单
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Java 类的一般特征
1. 创建类的对象时的内存结构 用图来解释: 使用new 创建 a1 时,成员变量的值都是初始默认值. 然后显式的改变其属性的值. 创建a3 时,a3 是直接指向 a1, 即a3 = a1, 两个对象 ...
- WP8.1 Study3:WP8.1中Animation应用
WP8.1上的Animation动画的API和WIN8/WIN8.1上的差不多,网上可以找到很多资料,同时可以去MSDN看官方文档. 下面是我参考一些资料,写出来的例子,希望以后有用. xaml代码如 ...
- 使用eclipse创建在myeclipse中运行的web工程
今天在跟随慕课网学习java时,遇到课程中老师使用Myeclipse,我用的是eclipse,那么就使用eclipse创建在Myeclipse项目 参考: 如何在Eclipse配置Tomcat服务器 ...
- java---数据格式的验证
package cc.cococ.trade.util; import java.util.regex.Matcher; import java.util.regex.Pattern; public ...