/// <param name="toAddr">接受人地址</param>
/// <param name="Cc">抄送</param>
/// <param name="Mcc">密送</param>
/// <param name="from">发送人地址</param>
/// <param name="content">邮件内容</param>
/// <param name="subject">邮件标题</param>
/// <param name="attach">附件</param>
/// <param name="Pwd">密码</param>
public void SendMailByPlainFormat(string toAddr, string Cc, string Mcc, string from, string content, string subject, string attach,string Pwd)
{
MailMessage mailobj = new MailMessage();
mailobj.From = new MailAddress(from);//发件人
//mailobj.To.Add(toAddr); //收件人或下面的收件人组
#region 收件人组
ArrayList list = new ArrayList();
list.Add("**@163.com");
list.Add("**@qq.com");
for (int i = 0; i < list.Count; i++)
{
MailAddress toAddress = new MailAddress(list[i].ToString());
mailobj.To.Add(toAddress);//收件人
}
#endregion
if (Cc != "")
mailobj.CC.Add(Cc); //抄送
if (Mcc != "")
mailobj.Bcc.Add(Mcc); //密送
mailobj.Priority = MailPriority.High; //发送优先级
mailobj.Subject = subject; //主题
mailobj.Body = content; //内容
mailobj.IsBodyHtml = true; //内容是否可以为html形式
mailobj.BodyEncoding = Encoding.Default;
if (attach != "")
{
char[] delim = new char[] { ';' };
foreach (string substr in attach.Split(delim))
{
Attachment MyAttach = new Attachment(substr);
//MailAttachment MyAttach = new MailAttachment(substr);
mailobj.Attachments.Add(MyAttach);
}
}
SmtpClient smtp = new SmtpClient();
//smtp.Host = this.server; //服务器
//smtp.Port = this.port; //端口
//smtp.Credentials = new System.Net.NetworkCredential(this.user, this.password); //用户名和密码
smtp.Host = "smtp."+from.Substring(from.IndexOf("@")+1); //服务器
smtp.Port = 25; //端口
smtp.Credentials = new System.Net.NetworkCredential(from, Pwd); //用户名和密码
smtp.Send(mailobj);
}