好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > .net SMTP發送Email實例(可帶附件)

.net SMTP發送Email實例(可帶附件)

熱門標簽:怎么給超市做地圖標注入駐店 外呼系統代理品牌 手機地圖標注如何刪除 外呼系統費用一年 辦理400電話證件 十堰正規電銷機器人系統 巫師3為什么地圖標注的財寶沒有 寧波自動外呼系統代理 世紀佳緣地圖標注怎么去掉
復制代碼 代碼如下:

public static void sendEmail(string toAddress, string emailbody)
{
var fromAddress = ConfigurationManager.AppSettings["EmailAddress"];
string fromPassword = ConfigurationManager.AppSettings["EmailPassword"].ToString();
const string subject = "Job Recommendation";
var smtp = new SmtpClient
{
Host = ConfigurationManager.AppSettings["SmtpServer"].ToString(),
Port = int.Parse(ConfigurationManager.AppSettings["SmtpPort"]),
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(fromAddress, fromPassword)
};
using (var message = new MailMessage(fromAddress, toAddress, subject, HttpUtility.HtmlEncode(emailbody)))
{
smtp.Send(message);
}
}
add key="EmailAddress" value="**********@gmail.com"/>//Email Address
add key="EmailPassword" value="*********"/> //Emial PWD
add key="SmtpServer" value="smtp.gmail.com"/>
add key="SmtpPort" value="587"/>
--帶附件版本->
var fromAddress = "allenyinj@gmail.com";
string fromPassword = "yj1989120";
const string subject = "CV";
var smtp = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(fromAddress, fromPassword)
};
MailMessage email=new MailMessage(fromAddress, "allen.yin.jun@gmail.com");
email.Subject = "INLINE attachment TEST";
email.IsBodyHtml = true;
string attachmentPath = "C:\\3.jpeg";
Attachment inline = new Attachment(attachmentPath);
inline.ContentDisposition.Inline = true;
inline.ContentDisposition.DispositionType = DispositionTypeNames.Inline;
//inline.ContentId = "1";
//inline.ContentType.MediaType = "image/png";
inline.ContentType.Name = Path.GetFileName(attachmentPath);
email.Attachments.Add(inline);
email.Body = "test";
smtp.Send(email);
email.Dispose();
//如果沒有路徑,用Stream
Attachment letter = new Attachment(FileUploadLetter.FileContent, FileUploadLetter.PostedFile.ContentType);
letter.ContentDisposition.Inline = true;
letter.ContentDisposition.DispositionType = DispositionTypeNames.Inline;
//inline.ContentId = "1";
letter.ContentType.MediaType = FileUploadLetter.PostedFile.ContentType;
letter.ContentType.Name = Path.GetFileName(FileUploadLetter.PostedFile.FileName);
letter.Name = Path.GetFileName(FileUploadLetter.PostedFile.FileName);
您可能感興趣的文章:
  • .net SMTP發送Email郵件且可帶附件示例
  • php使用smtp發送支持附件的郵件示例
  • smtp發送帶附件的郵件代碼分享

標簽:泰州 通遼 景德鎮 平涼 山西 嘉興 牡丹江 天門

巨人網絡通訊聲明:本文標題《.net SMTP發送Email實例(可帶附件)》,本文關鍵詞  .net,SMTP,發送,Email,實例,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《.net SMTP發送Email實例(可帶附件)》相關的同類信息!
  • 本頁收集關于.net SMTP發送Email實例(可帶附件)的相關信息資訊供網民參考!
  • 推薦文章