Java Mail ·¢ËÍÓʼþ
package com.eastpro.batch.biz;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import java.security.spec.X509EncodedKeySpec;
public class SendMail {
private MimeMessage mimeMsg; //MIME mail object
private Session session;
private Properties props; //system property
private boolean needAuth = false;
private String username = "";
private String password = "";
private Multipart mp; //Multipart ,´æ·ÅÐżþ title\ÄÚÈÝ\¸½¼þµÈ
public SendMail(String smtp) {
setSmtpHost(smtp);
createMimeMessage();
}
/**
* @param hostName String
*/
public void setSmtpHost(String hostName) {
System.out.println("sytemÊôÐÔ£ºmail.smtp.host = " + hostName);
if (props == null) {
props = System.getProperties();
}
props.put("mail.smtp.host", hostName); //SMTPÖ÷»ú
}
/**
* @return boolean
*/
public boolean createMimeMessage() {
try {
System.out.println("session begin-------");
session = Session.getInstance(props, null);
}
catch (Exception e) {
System.err.println("Session.getInstance faild£¡" + e);
return false;
}
System.out.println("MimeMessage begin-------£¡");
try {
mimeMsg = new MimeMessage(session);
mp = new MimeMultipart();
return true;
}
catch (Exception e) {
System.err.println("MimeMessage fiald£¡" + e);
&n
Ïà¹ØÎĵµ£º
±¾ÎÄת×Ô£ºhttp://cyp-034.blog.163.com/blog/static/2823190520074691849380/
stream
´ú±íµÄÊÇÈκÎÓÐÄÜÁ¦²ú³öÊý¾ÝµÄÊý¾ÝÔ´£¬»òÊÇÈκÎÓÐÄÜÁ¦½ÓÊÕÊý¾ÝµÄ½ÓÊÕÔ´¡£ÔÚJavaµÄIOÖУ¬ËùÓеÄstream£¨°üÀ¨InputstreamºÍ
Out stream£©¶¼°üÀ¨Á½ÖÖÀàÐÍ£º
(1)×Ö½ÚÁ÷
±íʾÒÔ×Ö½ÚΪµ¥Î»´ÓstreamÖжÁÈ¡»òÍùstreamÖÐдÈë ......
ǿתһ¸öÊý×éÀàÐÍ ±ØÐëҪѻ·±éÀú
±ÈÈç
B[] b;
//A¼Ì³ÐB;
A[] a= (A[])b;
ÕâÑùתÊDz»Äܳɹ¦µÄ
ÕâÊÇΪʲô£¿ÈçºÎ½â¾ö£¿
Ò²¾ÍÊÇ˵
for( int i=0; i<b.length; i++ )
{
a[i]=(A)b[i];
}
ÕâÑùת£¡ ......
jspx Ò»¸öÀ´×ÔÓÚ°£¼°µÄjava web¿ìËÙ¿ª·¢¿ò¼Ü
À´Ô´£ºhttp://www.javaeye.com/news/4887
Ã÷£ºJavaEyeÐÂÎÅÎÄÕµİæȨÊôÓÚJavaEyeÍøÕ¾ËùÓУ¬ÑϽûÈκÎÍøվתÔر¾ÎÄ£¬·ñÔò±Ø½«×·¾¿·¨ÂÉÔðÈΣ¡
ÔõôÓÖð³öÒ»¸öweb¿ò¼Ü?
¿´¿´ÏÖ´æµÄJava webÓ¦ÓóÌÐò¿ò¼Ü£¬ÎÞÒ»ÀýÍâµÄÒªÇ󻨷ѴóÁ¿µÄʱ¼äÓ뾫Á¦ºó²Å¿ÉͶÈëÉ ......
JavaÓïÑÔµÄÒ»¸öÓŵã¾ÍÊÇÈ¡ÏûÁËÖ¸ÕëµÄ¸ÅÄµ«Ò²µ¼ÖÂÁËÐí¶à³ÌÐòÔ±ÔÚ±à³ÌÖг£³£ºöÂÔÁ˶ÔÏóÓëÒý
ÓõÄÇø±ð£¬±¾ÎÄ»áÊÔͼ³ÎÇåÕâÒ»¸ÅÄî¡£²¢ÇÒÓÉÓÚJava²»ÄÜͨ¹ý¼òµ¥µÄ¸³ÖµÀ´½â¾ö¶ÔÏó¸´ÖƵÄÎÊÌ⣬ÔÚ¿ª·¢¹ý³ÌÖУ¬Ò²³£³£ÒªÒªÓ¦ÓÃclone£¨£©·½·¨À´¸´ÖƶÔ
Ïó¡£±¾ÎÄ»áÈÃÄãÁ˽âʲôÊÇÓ°×ÓcloneÓëÉî¶Èclone£¬ÈÏʶËüÃǵÄÇø±ð¡¢Óŵ㼰ȱµã¡£ ......