import java.util.*;

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

public class SimpleSendMessage {

public static void main(String[] args) { " /> 欧美日韩成人在线观看,97热久久免费频精品99国产成人,老湿影院福利社

一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

郵件發送簡單例子-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文件,轉載需保留來源!

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

主站蜘蛛池模板: 一区二区三区在线免费视频 | 视频一区 精品自拍 | 玖玖精品在线视频 | 国产成人精品一区二区视频 | 伊人久久综在合线亚洲不卡 | 涩涩视频网站 | 狠狠久久综合 | 欧美成人天天综合天天在线 | 起碰97| 黄色美女网站免费看 | 国产剧情在线视频 | 免费人成a大片在线观看动漫 | 中文字幕一区二区在线视频 | www.91自拍| 怡红院亚洲红怡院在线观看 | 91久久香蕉青青草原娱乐 | 国产中的精品一区的 | 午夜亚洲国产 | 色天使色婷婷在线影院亚洲 | 91高清国产视频 | 一区二区三区91 | 高清视频一区 | 成人激情视频网 | 亚洲天堂久久精品 | 91视频专区 | 国产精品国产 | 日韩欧美一区二区三区 | 91在线蜜桃臀 | 亚洲国产97在线精品一区 | 99精品视频一区在线视频免费观看 | 亚洲小说另类 | 久久精品国产一区二区 | 激情五月婷婷综合网 | 激情一区二区三区成人 | 免费一区二区三区免费视频 | 成人福利网 | www.四虎在线观看 | 国产一区二区三区在线视频 | 日本免费视屏 | 亚洲国产成人久久一区www | 精品欧美亚洲韩国日本久久 |