Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java Mail·¢Ë͸½¼þÓʼþ

±¾Ìùת×Ô£ºhttp://zhengxuezhou.javaeye.com/blog/540815
ÀûÓÃSun¹«Ë¾ÌṩµÄJavaMail
API¿ÉÒԺܷ½±ãµÄ¿ª·¢Óʼþ·¢ËͳÌÐò¡£Ò²ÐíÄãÒѾ­¿ÉÒÔÀûÓÃËüÀ´·¢ËÍÒ»¶Î¼òµ¥µÄÎı¾ÁË£¬µ«Ïë²»ÏëʹÄãµÄ³ÌÐòÏñOUTLOOKÒ»ÑùÒ²ÄÜ·¢Ë͸½¼þÄØ£¿±¾ÎÄÔÚ¼òµ¥
½éÉÜÁËJavaMailÖ®ºó£¬Ïêϸ½²½âÁËÒ»¶ÎÍêÕûµÄËÍÐŵÄJavaBean¼°Ò»¸öÊ®·ÖÇáÇɵÄservlet¡£
£¨Ã»ÓÐ×°ÔØJavaMail APIµÄ¶ÁÕߣ¬¿ÉÒÔµ½´ËÕ¾µãÏÂÔØ£¬²¢°´ÕÕReadme.txtÉèÖúÃClassPath£©
Ò»¡¢JavaMailÖÐһЩÎÒÃÇÐèÒªµÄÀà
1.Properties
JavaMailÐèÒªPropertiesÀ´´´½¨Ò»¸ösession¶ÔÏó£¬ÆäÊôÐÔÖµ¾ÍÊÇ·¢ËÍÓʼþµÄÖ÷»ú£¬È磺
Properties props = new Properties ();
props.put("mail.smtp.host",
"smtp.xxxx.com");//¿ÉÒÔ»»ÉÏÄãµÄsmtpÖ÷»úÃû£¬¾ÍÏñÄãÔÚOutLookÖÐÉèÖÃsmtpÖ÷»úÃûÒ»Ñù¡£
2.Session
ËùÓеĻùÓÚJavaMailµÄ³ÌÐò¶¼ÖÁÉÙÐèÒªÒ»¸ö»òÈ«²¿µÄ¶Ô»°Ä¿±ê¡£
Session session = Session.getInstance(props, null);
3.MimeMessage
ÐÅÏ¢¶ÔÏ󽫰ÑÄãËù·¢Ë͵ÄÓʼþÕæʵµÄ·´Ó³³öÀ´¡£
MimeMessage msg = new MimeMessage(session);
4.Transport
ÓʼþµÄ·¢ËÍÊÇÓÉTransportÀ´Íê³ÉµÄ£º
Transport.send(msg);
¶þ¡¢ÎÒÃÇ×Ô¼º´´½¨µÄ¿É·¢Ë͸½¼þµÄÀà
import java.util.* ;
import java.io.* ;
import javax.mail.* ;
import javax.mail.internet.* ;
import javax.activation.* ;
public class Mail {
//¶¨Òå·¢¼þÈË¡¢ÊÕ¼þÈË¡¢Ö÷ÌâµÈ
String to="";
String from="";
String host="";
String filename="";
String subject="";
//ÓÃÓÚ±£´æ·¢Ë͸½¼þµÄÎļþÃûµÄ¼¯ºÏ
Vector file = new Vector();
//×öÒ»¸ö¿ÉÒÔ´«·¢¼þÈ˵ȲÎÊýµÄ¹¹Ôì
public Mail (String to,String from,String smtpServer,String
subject){
//³õʼ»¯·¢¼þÈË¡¢ÊÕ¼þÈË¡¢Ö÷ÌâµÈ
this.to=to;
this.from=from;
this.host=smtpServer;
this.subject=subject;
}
//¸Ã·½·¨ÓÃÓÚÊÕ¼¯¸½¼þÃû
public void attachfile(String fname){
file.addElement(fname);
}
//¿ªÊ¼·¢ËÍÐżþµÄ·½·¨
public boolean startSend(){
//´´½¨Properties¶ÔÏó
Properties props = System.getProperties();
//´´½¨Ðżþ·þÎñÆ÷
props.put("mail.smtp.host", host);
//µÃµ½Ä¬ÈϵĶԻ°¶ÔÏó
Session session=Session.getDefaultInstance(props, null); try {
//´´½¨Ò»¸öÏûÏ¢£¬²¢³


Ïà¹ØÎĵµ£º

ÂÛjava¼Ü¹¹Éè¼Æ

Èí¼þ¼Ü¹¹
×÷Ϊһ¸ö¸ÅÄÌåÏÖÔÚ¼¼Êõ
ºÍÒµÎñ
Á½
¸ö·½Ãæ¡£
´Ó¼¼Êõ½Ç¶ÈÀ´Ëµ
£ºÈí¼þ¼Ü¹¹Ëæ׿¼ÊõµÄ¸ïв»¶ÏµØ¸üÐÂÆäÄÚÈÝ£¬Èí¼þ¼Ü¹¹½¨Á¢ÓÚµ±Ç°¼¼Êõ
ºÍһЩ»ù
±¾Ô­Ôò
µÄ»ù´¡Ö®ÉÏ¡£
ÏÈ˵һЩ»ù±¾Ô­Ôò
£º
·Ö²ãÔ­Ôò
£º·Ö²ãÊÇΪÁ˽µµÍÈí¼þÉî¶È¸´ÔÓÐÔ¶øʹÓõĹؼü˼Ï룬¾ÍÏñÉç»áÓÐÁ˽׼¶Ò»Ñù£¬Èí¼þÓÐÁ˲ã´Î½á¹¹¡£
Ä£¿é»¯ ......

ÔÚ¿ØÖÆ̨ÏÂjava±àÒëÕÒ²»µ½·ûºÅ ½â¾ö·½·¨

ͨ³£Çé¿öÏ£¬ÎÒÃÇÔÚ±àдjavaÎļþʱ£¬»áÓÐÒýÓõ½×ÔÒѶ¨ÒåµÄһЩÀ࣬Èç¹û°´Í¨³£µÄjavac *.javaµÄÐÎʽÀ´±àÒë»á³öÏÖÕÒ²»µ½·ûºÅµÄ´íÎó¡£
ÒÔÏÂÌṩÁËÁ½ÖÖ·½·¨£¬ÒÔ¹©²Î¿¼
¼ÙÈçÔÚd:\web\wshÏÂÓÐa.javaºÍb.javaÁ½¸öÎļþ£¬ÔÚb.javaÎļþÖÐÓÐÒýÓÃÁËa.java¡£ÏÂÃæÊDZàÒëµÄ·½·¨
·½·¨Ò»:
½øÈëd:\web\wshÏ£º javac a.java
È»ºóÍ˳öwshÄ ......

ʵսWEB ·þÎñÆ÷£¨JAVA±àдWEB·þÎñÆ÷£©

¡¡¡¡Ò»¡¢³¬Îı¾´«ÊäЭÒé
¡¡¡¡¡¡¡¡1.1 HTTPÇëÇó
¡¡¡¡¡¡¡¡1.2 HTTPÓ¦´ð
¡¡¡¡¶þ¡¢SocketÀà
¡¡¡¡Èý¡¢ServerSocketÀà
¡¡¡¡ËÄ¡¢Web·þÎñÆ÷ʵÀý
¡¡¡¡¡¡¡¡4.1 HttpServerÀà
¡¡¡¡¡¡¡¡4.2 RequestÀà
¡¡¡¡¡¡¡¡4.3 ResponseÀà
¡¡¡¡Îå¡¢±àÒëºÍÔËÐÐ
¡¡¡¡===================
¡¡¡¡ÕýÎÄ£º
¡¡¡¡=================== ......

web¿ª·¢µÄһЩÎÊÌâ(java·½Ïò)

 1.      ·ÖÒ³µÄ½â¾ö·½°¸£¬Í¨ÓÃÐÔ£¬·Öҳʱ²ÎÊý¶ªÊ§ÎÊÌ⣬ÈçºÎ½â¾ö£¿
      2.      HibernateÓÅ»¯ÎÊÌâ¡£ÈçºÎÓÅ»¯Êý¾Ý¿â·ÃÎÊ£¬Ê¹³ÌÐò·ÃÎÊÊý¾Ý¿â¸üÓÅ»¯¡£
      ¡¡³õÓÃHIBERNATEµÄÈËÒ²Ðí¶¼Óöµ½¹ýÐÔÄÜÎÊÌ⣬ʵÏÖ ......

JAVA ¶¯Ì¬¹¹½¨Ê÷(2)

 ¶¯Ì¬¹¹½¨Ê÷µÄÄ£Ðͺͷ½·¨£º
 
/**
 * ¸ÃÄ£¿éÖ÷ÒªÊǽ«ÎÞ¹æÔò´æ·ÅµÄ¶ÔÏó½øÐÐÒ»¸öÓÐ×éÖ¯µÄÊ÷Ðνڵ㴦Àí
 * @author ÏļҼª<jijin0223@126.com>
 *
 */
public class SystemMenuTreeModel {
 
    public SystemMenuTreeModel(){
    & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ