using System.Net.Mail;
public void send_email(string msg, string mysubject, string address)
{
MailMessage message = new MailMessage("ahhsu@blogspot.com", address);//MailMessage(寄信者, 收信者)
message.IsBodyHtml = true;
message.BodyEncoding = System.Text.Encoding.UTF8;//E-mail編碼
message.Subject = mysubject;//E-mail主旨
message.Body = msg;//E-mail內容
message.Headers.Add("X-MSMail-Priority","High");//重要信標示
message.Headers.Add("X-Priority", "1");//重要信標示
SmtpClient smtpClient = new SmtpClient("192.168.1.XX", 25);//設定E-mail Server和port
smtpClient.Send(message);
}
send_email("測試內容", "測試主旨標題", "ahhsu@blogspot.com");//呼叫send_email函式測試
send_email("測試內容", "測試主旨標題", "ahhsu@blogspot.com,andy@good.com");//也可一次寄給多人