import java.util.*;

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

public class SimpleSendMessage {

public static void main(String[] args) { " /> 一级黄色录像视频,国产 第1页,5g影院天天爽天天

一区二区久久-一区二区三区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)載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 91成人精品 | 在线成人 | 日韩在线视频第一页 | 成人区精品一区二区不卡亚洲 | 精品孕妇一区二区三区 | 青青视频国产在线播放 | 看免费5xxaaa毛片 | 久久精品一| 二区在线视频 | 国产视频第一页 | 国产福利在线观看精品 | 亚洲伊人久久网 | 91精品国产91久久久久久 | 久久精品青草社区 | 91国语精品自产拍在线观看性色 | 欧美日韩不卡码一区二区三区 | 成人午夜精品视频在线观看 | 97午夜视频| 亚洲日本欧美产综合在线 | 亚洲欧美成人 | 99久久精品免费观看国产 | 欧美性与交视频在线观看 | 热久久综合网 | www.黄色在线 | 色婷婷久久合月综 | 99热香蕉| 亚洲乱码在线 | 亚洲九九视频 | 2018狠狠操 | www.av网| 四虎影视在线永久免费看黄 | 综合在线视频 | 在线视频成人 | 91视频大全 | 久久99精品久久久久久秒播 | 天天操婷婷 | 一级寡妇乱色毛片全18 | 深爱五月开心网亚洲综合 | 精品国产91| 91秒拍国产福利一区 | 亚洲国产精品成人综合色在线婷婷 |