Send Mail using C# code
2013-10-23 10:15
399 查看
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 = 25; client.Host = "smtphost.mycompany.com"; client.Timeout = 10000; 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); } }
相关文章推荐
- [转]让国外邮件服务商不再拒收你的邮件,The IP you're using to send mail is not authorized
- How to send mail using any email account through Foxmail ? - Foxmail 6 漏洞,如何通过 Foxmail 用任意邮件账号发送邮件?
- csharp:SQLite and Access using C# code read data
- icsharpcode--An open source IDE for C#. Using plug-in architechtual
- Refactoring C# Code Using Visual Studio 2005 ----MSDN
- Using the string repalce action in SharePoint workflow designer to send mail from mail template
- How to send mail using VBScript & JMail - SourceCode - 如何用VBScript & JMail 发送邮件 - 源码
- How to send Email using C#
- 让国外邮件服务商不再拒收你的邮件,The IP you're using to send mail is not authorized
- Sending E-mail using C#
- HOW TO: Send email using System.Net.Mail
- Using Unsafe Code in C#
- c# send mail
- using System.Web.Mail to send email
- Mysql : C# sample code using ObjectDataSources
- Send out html emails in php using the mail func...
- Send_Mail_Code
- C# send mail with outlook and word mailmerge
- using System.Web.Mail to send email
- Handle unmanaged code in managed c# with the help of using statement