您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

JSP发送邮件实例_MySQL

2024/3/17 8:54:22发布27次查看
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);
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product