import java.util.*;

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

public class SimpleSendMessage {

public static void main(String[] args) { " /> 亚洲一级在线,www涩涩,国产无遮挡男女羞羞影院在线播放

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

郵件發(fā)送簡單例子-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技術(shù)郵件發(fā)送簡單例子-bean文件,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 国产精品一区视频 | 91精品综合国产在线观看 | 多色视频| 亚欧三级 | 精品视频在线观看 | 国产男女视频在线观看 | 性色综合| 青草国产在线 | 欧美一级做一级做片性十三 | 视频区图片区小说区 | 在线亚洲欧美性天天影院 | 狠狠伊人 | 九月丁香婷婷 | 国产二区三区 | 国内久久久久影院精品 | 99精品久久精品一区二区 | 思思久热re6这里有精品 | 午夜黄大色黄大片美女图片 | 16女性下面扒开无遮挡免费 | 久久久久久久久久免观看 | 国农村精品国产自线拍 | 国产福利在线观看精品 | 国产99在线播放免费 | 亚洲一区二区三区高清网 | 日韩黄色一级毛片 | 国产自线一二三四2021 | 色视频www在线播放国产人成 | 成人永久免费视频网站在线观看 | 免费小视频在线观看 | 五月国产综合视频在线观看 | 色喔喔| 国产小视频免费观看 | 午夜激情小视频 | 国产精品视频在 | 亚洲区视频 | 娇小videosbest8另类 | 美女张开腿让男人桶爽的免费动漫 | 天天拍夜夜添久久精品免费 | 久久国产精品视频一区 | 免费小视频在线观看 | 国产www网站 |