วันอังคารที่ 11 กุมภาพันธ์ พ.ศ. 2557
c# ส่งเมล์ พร้อมแนบไฟร์
using System.Net;
using System.Net.Mail;
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("yoonturbo@gmail.com");
mail.To.Add("yoonturbo@hotmail.com");
mail.Subject = "ชื่อเรื่อง";
mail.Body = "mail with attachment";
System.Net.Mail.Attachment attachment;
attachment = new System.Net.Mail.Attachment("c:\text.xls");
mail.Attachments.Add(attachment);
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("yoonturbo@gmail.com", "youpassword");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
StatusLabel2.Text = "เรียบร้อย";
//MessageBox.Show("mail Send");
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น