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的更多相关文章

  1. SSIS Send Mail

    在SSIS中Send Mail的方法主要有三种,使用Send Mail Task,使用Script Task和使用存储过程msdb.dbo.sp_send_dbmail. 一,使用Send Mail ...

  2. 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 ...

  3. 发送邮件的三种方式:Send Mail Message

    发送邮件的三种方式: 1.VBS 执行vbs脚本文件的程序为: system32文件下的 NameSpace = "http://schemas.microsoft.com/cdo/conf ...

  4. 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 ...

  5. Python 3.4 send mail

    #coding=utf-8 #Python 3.4 https://docs.python.org/3.4/library/ #IDE:Visual Studio 2015 Window10 impo ...

  6. golang:send mail using smtp package

    go语言发送邮件,可以使用smtp包,两个关键函数: func PlainAuth(identity, username, password, host string) Auth func SendM ...

  7. 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' #填入发送方邮箱的 ...

  8. C# send mail with outlook and word mailmerge

    http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.document_members(v=office.15). ...

  9. Send Mail 网址

    http://www.codeproject.com/Tips/371417/Send-Mail-Contact-Form-using-ASP-NET-and-Csharp http://www.c- ...

随机推荐

  1. DB、ETL、DW、OLAP、DM、BI关系结构图

    DB.ETL.DW.OLAP.DM.BI关系结构图 在此大概用口水话简单叙述一下他们几个概念: (1)DB/Database/数据库——这里一般指的就是OLTP数据库,在线事物数据库,用来支持生产的, ...

  2. AngularJS理论基础

    AngularJS理论基础 AngularJs是一个用于设计动态web应用的结构框架. 它是一个框架,不是类库,是像EXT一样提供一整套方案用于设计web应用.它不仅仅是一个javascript框架, ...

  3. 5月11日 ArrayList集合复习、特殊集合、枚举类型

    一.ArrayList集合复习 //定义 ArrayList al = new ArrayList(); //添加元素 al.Add(); //插入元素 al.Insert(,); //查看个数 in ...

  4. A-Apple Catching(POJ 2385)

    Apple Catching Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8759   Accepted: 4264 De ...

  5. Android中visibility属性VISIBLE、INVISIBLE、GONE的区别

    详情见:http://blog.csdn.net/chindroid/article/details/8000713

  6. js获取浏览器的版本代码

    <script>function GetXmlHttpObject(){var xmlHttp=null;var httptype='';try { // Firefox, Opera 8 ...

  7. WEBService动态调用代码

    BasicHttpBinding bind = new BasicHttpBinding(); bind.MaxReceivedMessageSize = int.MaxValue; Endpoint ...

  8. ASP.NET备份还原数据库

    核心技术:using System.Data.SqlClient;using System.IO;string SqlStr1 = "Server=(local);DataBase=mast ...

  9. 高效前端优化工具--Fiddler入门教程

    简介: Fiddler是用C#编写的一个免费的HTTP/HTTPS网络调试器.Fiddler是以代理服务器的方式,监听系统的网络数据流动英语中Fiddler是小提琴的意思,Fiddler Web De ...

  10. Linear Predictors

    In this chapter we will study the family of linear predictors, one of the most useful families of hy ...