濮阳杆衣贸易有限公司

主頁 > 知識庫 > 郵件發(fā)送簡單例子-jsp文件

郵件發(fā)送簡單例子-jsp文件

熱門標(biāo)簽:地圖標(biāo)注制作道路 四川電信外呼系統(tǒng)靠譜嗎 外呼系統(tǒng)啥意思 地圖標(biāo)注創(chuàng)業(yè)項(xiàng)目入駐 廣州三五防封電銷卡 珠海銷售外呼系統(tǒng)運(yùn)營商 山東智能云外呼管理系統(tǒng) 電銷外呼系統(tǒng) 排行榜 長春回?fù)芡夂粝到y(tǒng)廠家
MailExample.jsp

html>
head>
title>JSP JavaMail Example /title>
/head>

body>

%@ page import="java.util.*" %>
%@ page import="javax.mail.*" %>
%@ page import="javax.mail.internet.*" %>
%@ page import="javax.activation.*" %>

%
String host = "yourmailhost";
String to = request.getParameter("to");
String from = request.getParameter("from");
String subject = request.getParameter("subject");
String messageText = request.getParameter("body");
boolean sessionDebug = false;

// Create some properties and get the default Session.
Properties props = System.getProperties();
props.put("mail.host", host);
props.put("mail.transport.protocol", "smtp");

Session mailSession = Session.getDefaultInstance(props, null);

// Set debug on the Session so we can see what is going on
// Passing false will not echo debug info, and passing true
// will.
mailSession.setDebug(sessionDebug);

// Instantiate a new MimeMessage and fill it with the
// required information.
Message msg = new MimeMessage(mailSession);

msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
msg.setSentDate(new Date());
msg.setText(messageText);

// Hand the message to the default transport service
// for delivery.
Transport.send(msg);

out.println("Mail was sent to " + to);
out.println(" from " + from);
out.println(" using host " + host + ".");

%>
/table>
/body>
/html>

您可能感興趣的文章:
  • JSP發(fā)送郵件實(shí)例
  • jspsmart文件上傳與郵件發(fā)送的實(shí)例
  • node.js使用nodemailer發(fā)送郵件實(shí)例
  • Nodejs中讀取中文文件編碼問題、發(fā)送郵件和定時任務(wù)實(shí)例
  • 純javascript實(shí)現(xiàn)自動發(fā)送郵件
  • 基于Node.js實(shí)現(xiàn)nodemailer郵件發(fā)送

標(biāo)簽:北海 吳忠 廣元 紹興 肇慶 保定 潮州 玉樹

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《郵件發(fā)送簡單例子-jsp文件》,本文關(guān)鍵詞  郵件,發(fā)送,簡單,例子,-jsp,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《郵件發(fā)送簡單例子-jsp文件》相關(guān)的同類信息!
  • 本頁收集關(guān)于郵件發(fā)送簡單例子-jsp文件的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    南江县| 沙河市| 西盟| 商城县| 务川| 阿城市| 扬中市| 巨鹿县| 夏河县| 吉首市| 县级市| 武宣县| 平乐县| 红安县| 都兰县| 吉林市| 惠来县| 华阴市| 肇州县| 信丰县| 商河县| 自治县| 涪陵区| 宣汉县| 遵义县| 灯塔市| 青龙| 余庆县| 桓台县| 交城县| 泾源县| 周口市| 调兵山市| 闻喜县| 策勒县| 广汉市| 和顺县| 云霄县| 遵义市| 都兰县| 昌黎县|