import java.util.*;

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

public class SimpleSendMessage {

public static void main(String[] args) { " /> 国产精品一区免费在线观看,无码国模国产在线观看,爱爱无遮挡

中文字幕日韩一区二区_国产一区二区av_国产毛片av_久久久久国产一区_色婷婷电影_国产一区二区精品

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

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

主站蜘蛛池模板: 伊人久久国产 | 国产在线一区二区三区 | 国产高清在线观看 | 日本久久久久久久久 | av在线三级 | 在线播放国产视频 | 日韩免费在线视频 | 国产精品久久久久久久久久99 | 美女在线一区二区 | 成人精品一区二区 | 国产在线二区 | 国产精品久久精品 | 成人夜晚看av | 中文字幕11页 | 美女在线视频一区二区三区 | 91成人在线| 久久综合欧美 | 99久热 | 精品久久99 | 欧美日韩国产一区二区三区 | gav成人免费播放视频 | 欧美精品一区二区三区在线 | 亚洲欧美激情网 | 欧美福利 | 成人精品国产一区二区4080 | 亚洲一区在线免费观看 | www.久久久久久久久久久 | 亚洲国产精品一区二区久久 | 激情在线视频 | 久久国产美女视频 | 国产精品夜夜夜一区二区三区尤 | 国产高清视频在线 | 午夜欧美 | 国产欧美一区二区三区日本久久久 | 午夜资源| 国产乱码精品一区二区三区忘忧草 | 亚洲中国字幕 | 91p在线观看| 又爽又黄axxx片免费观看 | 成人国产精品久久 | 91正在播放 |