import java.util.*;

import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SimpleSendMessage {

public static void main(String[] args) { " /> 久久超碰97,精品久久91,国产h视频在线观看

四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

郵件發送簡單例子-bean文件

SimpleSendMessage.Java

import Java.util.*;

import Javax.mail.*;
import Javax.mail.interNET.*;
import Javax.activation.*;

public class SimpleSendMessage {

public static void main(String[] args) {

// Collect the necessary information to send a simple message
// Make sure to replace the values for host, to, and from with
// valid information.
// host - must be a valid smtp server that you currently have
// access to.
// to - whoever is going to get your email
// from - whoever you want to be. Just remember that many smtp
// servers will validate the domain of the from address
// before allowing the mail to be sent.
String host = "server.myhost.com";
String to = "YourFriend@somewhere.com";
String from = "MeMeMe@myhost.com";
String subject = "JSP Rules!";
String messageText = "I am sending a message using the"
+ " JavaMail API./nI can include any text that I want.";
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 session = 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.
session.setDebug(sessionDebug);

try {

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

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);
}
catch (MessagingException mex) {

mex.printStackTrace();
}
}
}

jsp技術郵件發送簡單例子-bean文件,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 小镇姑娘高清播放| 尹雪喜演的电影在线观看| 哈尔的移动城堡免费完整版| 听鬼故事长篇超吓人2000字| 普罗米修斯 电影| 电影在线观看网址| 乡村女老师| 画江湖之不良人第七季什么时候出| 高粱红了 电视剧| doors2怪物图鉴| alexis crystal| psv游戏| 诈欺游戏电影| 斯维特拜克之歌| 游泳池电影| 电影五十度黑| 恶魔天使| 家族荣誉4| 成人免费视频观看视频| 婚前婚后电影高清完整版| nanny| 漂亮孕妇肚子疼视频要生了| 青楼春凳打板子作文| 次强音| 1988年英国的白蛇传说| 不速之客美国恐怖电影2014| 明日战记| https://www.douyin.com| 女同版痴汉电车| 财税2010121号原文| 伊丽莎白·亨斯屈奇| kaylani lei| 真实游戏完整版高清观看| av电影网| 喜羊羊牛气冲天| 《桂花雨》课后题答案| 女公安毛片免费观看| 欢场| 第五单元初试身手| 抖音 下载| 飞龙猛将演员表|