濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > 郵件發(fā)送簡(jiǎn)單例子-jsp文件

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

熱門標(biāo)簽:地圖標(biāo)注制作道路 四川電信外呼系統(tǒng)靠譜嗎 外呼系統(tǒng)啥意思 地圖標(biāo)注創(chuàng)業(yè)項(xiàng)目入駐 廣州三五防封電銷卡 珠海銷售外呼系統(tǒng)運(yùn)營(yíng)商 山東智能云外呼管理系統(tǒng) 電銷外呼系統(tǒng) 排行榜 長(zhǎ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中讀取中文文件編碼問(wèn)題、發(fā)送郵件和定時(shí)任務(wù)實(shí)例
  • 純javascript實(shí)現(xiàn)自動(dòng)發(fā)送郵件
  • 基于Node.js實(shí)現(xiàn)nodemailer郵件發(fā)送

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

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《郵件發(fā)送簡(jiǎn)單例子-jsp文件》,本文關(guān)鍵詞  郵件,發(fā)送,簡(jiǎn)單,例子,-jsp,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《郵件發(fā)送簡(jiǎn)單例子-jsp文件》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于郵件發(fā)送簡(jiǎn)單例子-jsp文件的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    绥宁县| 丽江市| 镇宁| 沧州市| 中方县| 屏南县| 平顶山市| 栖霞市| 昌邑市| 泰州市| 连南| 宣恩县| 峡江县| 固安县| 海城市| 洱源县| 通渭县| 文安县| 沐川县| 海晏县| 临沭县| 临潭县| 青海省| 板桥市| 安顺市| 建始县| 什邡市| 上林县| 浠水县| 宁阳县| 徐闻县| 师宗县| 湖南省| 襄垣县| 昌都县| 会同县| 黄山市| 古交市| 灵山县| 镇巴县| 大丰市|