锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国内自拍欧美,精品综合久久久,九九精品视频在线看 http://www.aygfsteel.com/enlight/java瀛︿範(fàn)鎬葷粨 zh-cn Fri, 04 Jul 2025 22:37:45 GMT Fri, 04 Jul 2025 22:37:45 GMT 60 鍙戦侀偖浠墮氱煡鐨勭▼搴?渚涘叾瀹冪▼搴忚皟鐢? http://www.aygfsteel.com/enlight/archive/2006/07/07/57167.htmljava瀛翻 java瀛翻 Fri, 07 Jul 2006 09:41:00 GMT http://www.aygfsteel.com/enlight/archive/2006/07/07/57167.html http://www.aygfsteel.com/enlight/comments/57167.html http://www.aygfsteel.com/enlight/archive/2006/07/07/57167.html#Feedback 0 http://www.aygfsteel.com/enlight/comments/commentRss/57167.html http://www.aygfsteel.com/enlight/services/trackbacks/57167.html 鐜板湪榪樺彧鏄彂閫佹枃鏈偖浠?鏈夊叴瓚g殑鍙互鍐嶇湅涓涓嬪浣曞彂閫佽秴鏂囨湰閭歡,甯﹂檮浠剁瓑. //Author:Adrian 20060707 package asdf.asdf.mail; import java.util.Properties; import javax.mail.Message; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; //浣跨敤gmail鐨勯偖浠舵湇鍔″櫒 public 聽(tīng)class EmailNoticeEx{
聽(tīng) 聽(tīng)public static String sendSSLGmail(String fromName,String
fromEmail,String smtpServer,String smtpUser,String smtpPassword,String
recipient_name,String recipients[],String subject,String message,String
encoding){ 聽(tīng) try{ 聽(tīng) 聽(tīng)boolean debug = false; 聽(tīng) 聽(tīng)java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); 聽(tīng) 聽(tīng)// Set the host smtp address 聽(tīng) 聽(tīng)// 聽(tīng)璁劇疆緋葷粺灞炴?br /> 聽(tīng) 聽(tīng)Properties props = new Properties();//鑾峰緱緋葷粺灞炴у璞?br /> 聽(tīng) 聽(tīng)props.put("mail.transport.protocol", "smtp"); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)props.put("mail.host", smtpServer);//璁劇疆SMTP涓繪満 聽(tīng) 聽(tīng)MyAuthenticator auth = new MyAuthenticator(smtpUser, smtpPassword); 聽(tīng) 聽(tīng)//鑾峰緱閭歡浼?xì)璇濆璞?br /> 聽(tīng) 聽(tīng)Session mailSession = Session.getDefaultInstance(props, auth); 聽(tīng) 聽(tīng)mailSession.setDebug(debug); 聽(tīng) 聽(tīng)javax.mail.internet.MimeMessage mimeMsg; //MIME閭歡瀵硅薄 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)//鍒涘緩MIME閭歡瀵硅薄 聽(tīng) 聽(tīng)mimeMsg = new javax.mail.internet.MimeMessage(mailSession); 聽(tīng) 聽(tīng)// create a message 聽(tīng) 聽(tīng)//Message msg = new MimeMessage(session); 聽(tīng) 聽(tīng)// set the from and to address 聽(tīng) 聽(tīng)I(yíng)nternetAddress addressFrom = new InternetAddress(fromEmail,fromName); 聽(tīng) 聽(tīng)mimeMsg.setFrom(addressFrom); 聽(tīng) 聽(tīng)I(yíng)nternetAddress[] addressTo = new InternetAddress[recipients.length]; 聽(tīng) 聽(tīng)for (int i = 0; i < recipients.length; i++) { 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)addressTo[i] = new InternetAddress(recipients[i]); 聽(tīng) 聽(tīng)} 聽(tīng) 聽(tīng)mimeMsg.setRecipients(Message.RecipientType.TO, addressTo); 聽(tīng) 聽(tīng)// Setting the Subject and Content Type 聽(tīng) 聽(tīng)mimeMsg.setSubject(subject,encoding); 聽(tīng) 聽(tīng)mimeMsg.setContent(message, "text/plain"); 聽(tīng) 聽(tīng)mimeMsg.setText(message,encoding); 聽(tīng) 聽(tīng)Transport.send(mimeMsg); 聽(tīng) }catch(Exception e){ 聽(tīng) 聽(tīng) 聽(tīng) e.printStackTrace(); 聽(tīng) 聽(tīng) 聽(tīng) return e.getMessage(); 聽(tīng) } 聽(tīng) return null; 聽(tīng)} //浣跨敤鏅氱殑閭歡鏈嶅姟鍣?聽(tīng)
聽(tīng) 聽(tīng)public static String sendMail(String fromName,String
fromEmail,String smtpServer,String smtpUser,String smtpPassword,String
recipient_name,String recipients[],String subject,String message,String
encoding){ 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) try{ 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)boolean debug = false; 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)// Set the host smtp address 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)// 聽(tīng)璁劇疆緋葷粺灞炴?br /> 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)Properties props = new Properties();//鑾峰緱緋葷粺灞炴у璞?br /> 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)props.put("mail.transport.protocol", "smtp"); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)props.put("mail.smtp.starttls.enable","true"); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)props.put("mail.smtp.host", smtpServer);//璁劇疆SMTP涓繪満 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)props.put("mail.smtp.auth", "true"); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)MyAuthenticator auth = new MyAuthenticator(smtpUser, smtpPassword); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)//鑾峰緱閭歡浼?xì)璇濆璞?br /> 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)Session mailSession = Session.getDefaultInstance(props, auth); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)mailSession.setDebug(debug); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)javax.mail.internet.MimeMessage mimeMsg; //MIME閭歡瀵硅薄 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)//鍒涘緩MIME閭歡瀵硅薄 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)mimeMsg = new javax.mail.internet.MimeMessage(mailSession); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)// create a message 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)//Message msg = new MimeMessage(session); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)// set the from and to address 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)I(yíng)nternetAddress addressFrom = new InternetAddress(fromEmail,fromName); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)mimeMsg.setFrom(addressFrom); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)I(yíng)nternetAddress[] addressTo = new InternetAddress[recipients.length]; 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)for (int i = 0; i < recipients.length; i++) { 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)addressTo[i] = new InternetAddress(recipients[i]); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)} 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)mimeMsg.setRecipients(Message.RecipientType.TO, addressTo); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)// Setting the Subject and Content Type 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)mimeMsg.setSubject(subject,encoding); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)mimeMsg.setContent(message, "text/plain"); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)mimeMsg.setText(message,encoding); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)Transport.send(mimeMsg); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) }catch(Exception e){ 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) e.printStackTrace(); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) return e.getMessage(); 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) } 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) return null; 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng)} 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) 聽(tīng) }// end class // smtp闇瑕侀獙璇佹椂鍊欑殑楠岃瘉綾?br />class MyAuthenticator 聽(tīng) 聽(tīng)extends javax.mail.Authenticator { 聽(tīng)private String strUser; 聽(tīng)private String strPwd; 聽(tīng)public MyAuthenticator(String user, String password) { 聽(tīng) 聽(tīng)this.strUser = user; 聽(tīng) 聽(tīng)this.strPwd = password; 聽(tīng)} 聽(tīng)protected PasswordAuthentication getPasswordAuthentication() { 聽(tīng) 聽(tīng)return new PasswordAuthentication(strUser, strPwd); 聽(tīng)} }
銆妤間富:navIme2 ]]> java姝﹂寮涓氫簡(jiǎn)錛?/title> http://www.aygfsteel.com/enlight/archive/2006/06/23/54673.htmljava瀛翻 java瀛翻 Fri, 23 Jun 2006 06:51:00 GMT http://www.aygfsteel.com/enlight/archive/2006/06/23/54673.html http://www.aygfsteel.com/enlight/comments/54673.html http://www.aygfsteel.com/enlight/archive/2006/06/23/54673.html#Feedback 0 http://www.aygfsteel.com/enlight/comments/commentRss/54673.html http://www.aygfsteel.com/enlight/services/trackbacks/54673.html ]]>
主站蜘蛛池模板:
凭祥市 |
绍兴市 |
霍邱县 |
广安市 |
吴堡县 |
和硕县 |
桦川县 |
易门县 |
安庆市 |
江都市 |
新建县 |
高密市 |
奉化市 |
辰溪县 |
岱山县 |
江都市 |
阿拉善右旗 |
巴青县 |
邵阳县 |
吉林省 |
米泉市 |
钟祥市 |
多伦县 |
榕江县 |
昆山市 |
宜兰市 |
罗田县 |
鄯善县 |
通州市 |
冕宁县 |
达尔 |
浦江县 |
武胜县 |
阿拉尔市 |
齐齐哈尔市 |
江达县 |
湟中县 |
东城区 |
宝坻区 |
石家庄市 |
邯郸市 |