首先新建乙個郵件配置檔案到resources目錄下
#遠端請求位址配置#傳送人郵件位址
senderaddress=*
#傳送人郵件賬戶
senderaccount=*
#密碼
senderpassword=*
#郵件伺服器
host=*
public class emailutils );//5、關閉郵件連線
transport.close();
return true;
} /**
* 獲得建立一封郵件的例項物件.
*/public static mimemessage getmimemessage(session session,
string recipientaddress, string theme,string templatemail) throws exception
msg.setrecipients(mimemessage.recipienttype.to, receptientsemail);
//設定郵件主題
msg.setsubject(theme, "utf-8");
//設定郵件正文
msg.setcontent(templatemail, "text/html;charset=utf-8");
//設定郵件的傳送時間,預設立即傳送
msg.setsentdate(new date());
return msg;
}
利用Web傳送郵件
方法一 using system.web.mail system.web.mail.mailmessage myemail new system.web.mail.mailmessage myemail.from email 163.myemail.to email 163.myemail.subj...
C 郵件傳送類
c code using system using system.collections using system.componentmodel using system.data using system.drawing using system.web using system.web.sess...
PHP郵件傳送類
郵件傳送類 支援傳送純文字郵件和html格式的郵件 example config array from to subject test body test username password ishtml true mail new mysendmail mail setserver smtp.12...