MailMessage message = new MailMessage();
message.From = new MailAddress("xxx@gmail.com");//寄件人
message.To.Add("xxx@yahoo.com.tw");//收件人
message.SubjectEncoding = Encoding.UTF8;//標題編碼
message.Subject = Title;//標題
message.IsBodyHtml = true;//是否使用html格式
message.BodyEncoding = Encoding.UTF8;//內容編碼
message.Body = Content;//內容
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);//gmail smtp設定
smtp.Credentials = new System.Net.NetworkCredential("xxx@gmail.com", "xxxxx");//gmail 帳密


smtp.EnableSsl = true;//打開ssl
smtp.Send(message);//寄送

arrow
arrow
    文章標籤
    asp.net SMTP
    全站熱搜

    鴨鴨仔 發表在 痞客邦 留言(2) 人氣()