建立此類並引用,各引數都有相應注釋
using system;
using system.collections.generic;
using system.linq;
using system.net.mail;
using system.text;
using system.web;
namespace emaildemo
/// /// 收件人
///
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)}}
}
phpmailer郵箱傳送
引入phpmailer的核心檔案 require once common phpmailer master src phpmailer.php require once common phpmailer master src smtp.php use phpmailer phpmailer 例項化p...
python 傳送郵箱
coding utf 8 import smtplib from email.mime.multipart import mimemultipart from email.mime.text import mimetext from email.mime.image import mimeimage...
利用vbs傳送郵箱
namespace set emailobj createobject cdo.message emailobj.from xx 163.com 發件人,需修改 emailobj.to x qq.com 收件人,需修改 emailobj.subject 請假打卡 郵件主題 emailobj.html...