//these are the pakages to be imported from
// Java Mail
//The Java Mail PAckage either be dowloaded
//seperately
//or else is Available in the " /> 五月婷婷精品,欧美日韩一区二区三区四区,最近2019中文字幕大全视频1

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

JSP發送郵件實例

vishal_donth gave this response on 10/18/2000:  
//these are the pakages to be imported from  
// Java Mail  
//The Java Mail PAckage either be dowloaded  
//seperately  
//or else is Available in the J2sdkee1.2  
// (Java Enterprise Edition)  

import Javax.mail.*;  
import Javax.mail.interNET.*;  
import Java.util.*;  


//This function can be used to send the mail  
// with the parameters given to it  
//U have to specify the smtp server through  
//which u have to send the mail  
//since i was trying with a homeNETmail  
//account i directly sent the mail its server  
//For sending this mail u need a mail server  
//which lets u to relay the messages  
//Try this thing for sending to a  
//www.homeNETmail.com account because it lets  
//u send  
//mails to the accounts like example try  
//sending it to a "abc@homeNETmail.com"  
//account.Create the mail account in homeNET  
//mail first. If u get any other server which  
//supports relaying u can try this on that  
//also.  

//Use this function in ur Servlet to send  
//mail by calling the function with the  
//parameters  

public void sendMail(String toAddr, String subject, String body, String fromAddr)throws RemoteException{  
try{  
Properties props = new Properties();  
props.put("mail.smtp.host","mail.homeNETmail.com");  
//Here we specify the SMTP server through  
//which the mail should be delivered  
Session session = Session.getDefaultInstance(props, null);  
Message msg = new MimeMessage(session);  
msg.setFrom(new InterNETAddress(fromAddr));  
//Specify the From Address  
InterNETAddress[] tos =InterNETAddress.parse(toAddr);  
//Specify the To Address  
msg.setRecipients(Message.RecipientType.TO,tos);  
msg.setSubject(subject);  
//Specify the Subject  
msg.setText(body);  
//Specify the Body  
Transport.send(msg);  
System.out.println("Message is Sent");  
}  
catch(Exception e){  
System.out.println(e);  
}  
}  

// U have to run this function on a computer  
//which is directly connected  
// to interNET but not through a  
//proxy......or else use a proxy which  
//supports SMTP  

jsp技術JSP發送郵件實例,轉載需保留來源!

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

主站蜘蛛池模板: 亚洲国产99在线精品一区二区 | 久久激情五月 | 国产成人久久精品推最新 | 久久久国产一区二区三区丝袜 | 伊人色综合久久成人 | 国产成人一区二区三区在线视频 | 丁香视频在线观看播放 | 制服丝袜怡红院 | 四虎4hu | 国产精品资源在线观看网站 | 久久夜色精品国产噜噜小说 | 福利一区二区视频 | 色多多免费观看 | 成人福利在线观看 | 国产精品麻豆一区二区三区v视界 | 亚洲骚色 | 一本色道久久综合 | 欧美极品美軳人人体 | 综合成人| 日韩在线中文字幕 | 国产福利在线 | 51短视频版在线观看www免费 | 福利视频免费看 | 好叼操这里只有精品 | 国产麻豆精品视频 | 成人资源在线观看 | 图片区小说区区国产明星 | 久草免费在线色站 | 91精品福利老司机在线观看 | 免费真实播放国产乱子伦 | 久久永久视频 | 国产高清a| 在线观看视频www在线观看 | 亚洲免费h | 美女毛片在线看 | 综合久久综合久久 | 小说专区图片专区 | 亚洲成年网 | 最新国产成人综合在线观看 | 91在线视频福利 | 欧美成人全部费免网站 |