求C#邮件例子
求C#邮件例子
最好是给我一个类拿起来就能用。
------解决方案--------------------using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
private void sende_mail()
{
MailMessage mms = new MailMessage();
mms.Body = "邮件内容";
mms.Subject = "邮件标题";
mms.IsBodyHtml = true;
mms.Attachments.Add(new Attachment("附件路径"));//可以不写
mms.From = new MailAddress("发件人邮箱");
mms.To.Add(new MailAddress("收件人邮箱"));
SmtpClient p = new SmtpClient();
p.Host = "smtp服务器";//例如126邮箱就用smtp.126.com
p.Credentials = new System.Net.NetworkCredential("发件人邮箱的用户名", "发件人邮箱的密码");
p.Send(mms);
}
------解决方案--------------------http://www.cnblogs.com/AlphaWu/archive/2006/12/18/596205.html
------解决方案--------------------asp.net 发送邮件
C#(WinForm)如何发送带附件的电子邮件
------解决方案--------------------using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
private void sende_mail()
{
MailMessage mms = new MailMessage();
mms.Body = "邮件内容";
mms.Subject = "邮件标题";
mms.IsBodyHtml = true;
mms.Attachments.Add(new Attachment("附件路径"));//可以不写
mms.From = new MailAddress("发件人邮箱");
mms.To.Add(new MailAddress("收件人邮箱"));
SmtpClient p = new SmtpClient();
p.Host = "smtp服务器";//例如126邮箱就用smtp.126.com
p.Credentials = new System.Net.NetworkCredential("发件人邮箱的用户名", "发件人邮箱的密码");
p.Send(mms);
}
这个应该可以的啊。
------解决方案--------------------using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
/// <summary>
/// sendmail 的摘要说明