C# Email 寄出
//formName: 寄件者姓名
//fromEmail: 寄件者mail
//title: 信件title
//sendMailList: 收件者
//content: 寄件內容
public void sendMail(string fromEmail, string title, List<string> sendMailList, string content)
{
//string body = "寄件者:" + name + " Email帳號:" + fromEmail + " 內容:" + description + " "
// + "請到管理後台回復信件";
// 設定Gmail SMTP位址, 以及Gmail帳號
SmtpClient client = new SmtpClient("mail.webgenie.com.tw");
client.Credentials = new NetworkCredential("jeff", "qwer123456");
//client.EnableSsl = true; //安全性的驗證
//寄件人、主旨、內容
MailMessage mail = new MailMessage();
mail.From = new MailAddress(fromEmail);
mail.Subject = title;
mail.IsBodyHtml = true;
mail.Body = content;
//收件人
for (int i = 0; i < sendMailList.Count; i++)
{
mail.To.Add(sendMailList[i]);
}
////附件
client.Send(mail);
}
標籤: C#
0 個意見:
張貼留言
訂閱 張貼留言 [Atom]
<< 首頁