import java.util.*;

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

public class SimpleSendMessage {

public static void main(String[] args) { " /> 欧美区一区,黄片1234,日本网站在线

一区二区久久-一区二区三区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文件,轉載需保留來源!

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

主站蜘蛛池模板: 欧美成人丝袜一区二区 | 欧美一区二区三区性 | 巨胸喷奶水www久久久免费观看 | 国产一区在线mmai | 伊人中文字幕在线 | 国产精品久久现线拍久青草 | 亚洲大色堂 | 国产激情视频在线观看首页 | 国产婷婷一区二区在线观看 | 天天拍拍天天爽免费视频 | 午夜乩伦| 精品日韩欧美国产一区二区 | 国产精品资源网站在线观看 | 992tv又爽又黄的免费视频 | 国产精品七七在线播放 | 成人激情小视频 | 欧洲a老妇女黄大片 | 免费一区二区视频 | 性色a v 一区| 秋霞影音先锋一区二区 | 玖玖在线播放 | 亚洲国产成人在线观看 | 国产成人精品综合网站 | 丁香激情六月天 | 国产在线视频www色 国产在线视频第一页 | 欧美激情视频一区 | 亚洲第一网站免费视频 | 成人免费观看完整视频 | 中文字幕福利 | 九九综合视频 | 色综合图片 | 一区二区三区在线免费 | 国产精品免费小视频 | 91精品免费久久久久久久久 | 四虎国产永久在线精品免费观看 | 亚洲精品成人中文网 | 免费观看成人鲁鲁鲁鲁鲁视频 | 中文字幕一级毛片 | 国产91福利| 日日噜噜夜夜狠狠tv视频免费 | 日本精品视频一区 |