C 傳送郵件類

2021-08-07 07:33:47 字數 1762 閱讀 9577

public class email

/// /// 收件人

///

public string mailtoarray

/// /// 抄送

///

public string mailccarray

/// /// 標題

///

public string mailsubject

/// /// 正文

///

public string mailbody

/// /// 發件人密碼

///

public string mailpwd

/// /// smtp郵件伺服器

///

public string host

/// /// 正文是否是html格式

///

public bool isbodyhtml

/// /// 附件

///

public string attachmentspath

public bool send()

}//向抄送收件人位址集合新增郵件位址

if (mailccarray != null)

}//發件人位址

mymail.from = maddr;

//電子郵件的標題

mymail.subject = mailsubject;

//電子郵件的主題內容使用的編碼

mymail.subjectencoding = encoding.utf8;

//電子郵件正文

mymail.body = mailbody;

//電子郵件正文的編碼

mymail.bodyencoding = encoding.default;

mymail.priority = mailpriority.high;

mymail.isbodyhtml = isbodyhtml;

//在有附件的情況下新增附件

try}

}catch (exception err)

smtpclient smtp = new smtpclient();

//指定發件人的郵件位址和密碼以驗證發件人身份

smtp.credentials = new system.net.networkcredential(mailfrom, mailpwd);

//設定smtp郵件伺服器

smtp.host = host;

trycatch (system.net.mail.smtpexception ex)}}

//呼叫

/* email email = new email();

email.mailfrom = "";//傳送人的郵箱位址

email.mailpwd = "";//傳送人郵箱的密碼

email.mailsubject = "";//郵件主題

email.mailbody = "";//郵件內容

email.isbodyhtml = true; //是否是html

email.host = "smtp.163.com";//如果是qq郵箱則:smtp:qq.com,依次類推

email.mailtoarray = new string ;//接收者郵件集合

= new string ;//抄送者郵件集合

email.send().tostring();

*/

C 郵件傳送類

c code using system using system.collections using system.componentmodel using system.data using system.drawing using system.web using system.web.sess...

C 郵件傳送輔助類

using system using system.net.mail using system.net.mime using system.io using system.collections.generic public class mailhelper 用來傳送電子郵件的 smtp 主機伺服器...

C 郵件傳送 實現類

using system using system.collections.generic using system.configuration using system.io using system.linq using system.net.mail using system.net.mime...