java ·¢ËÍÓʼþʵÀý
package com.sj.main;
public class Snippet {
public static void main(String[] args){
//Õâ¸öÀàÖ÷ÒªÊÇÉèÖÃÓʼþ
MailSenderInfo mailInfo = new MailSenderInfo();
String biaoti ="ÎÒÊÇËÕ½¨£¬ÕâÊÇÎҵIJâÊÔÓʼþ";
String neirong = "ÎÒÊÇËÕ½¨ÒÔÏÂÊÇÎҵIJâÊÔÓʼþ£¬»¶Ó´ó¼Ò½øÐвâÊÔ¡£±¾³ÌÐòʹÓõÄÊÇJavaÓ¦ÓóÌÐò¿ª·¢µÄ" +
"ÎÒÃÇÒÔϵijÌÐò´úÂë½øÐÐ×¢²áÁ¬½Óhttp://blog.csdn.net/sujianchinaouya";
String towho="112606652@qq.com";
mailInfo.setMailServerHost("smtp.163.com");
mailInfo.setMailServerPort("25");
mailInfo.setValidate(true);
mailInfo.setUserName("sujiansoft@163.com");
mailInfo.setPassword("03585726709");//ÄúµÄÓÊÏäÃÜÂë
mailInfo.setfromAddress("sujiansoft@163.com");
mailInfo.setToAddress(towho);
mailInfo.setSubject(biaoti);
mailInfo.setContent(neirong);
//Õâ¸öÀàÖ÷ÒªÀ´·¢ËÍÓʼþ
SimpleMailSender sms = new SimpleMailSender();
sms.sendTextMail(mailInfo);//·¢ËÍÎÄÌå¸ñʽ
System.out.println(mailInfo);
// sms.sendHtmlMail(mailInfo);//·¢ËÍhtml¸ñʽ
}
}
Java·¢ËÍÓʼþ
MailSenderInfo.java
package com.sj.main;
/** *//**
* ·¢ËÍÓʼþÐèҪʹÓõĻù±¾ÐÅÏ¢
*author by wangfun
http://www.5a520.cn С˵520
*/
import java.util.Properties;
public class MailSenderInfo {
// ·¢ËÍÓʼþµÄ·þÎñÆ÷µÄIPºÍ¶Ë¿Ú
private String mailServerHost;
private String mailServerPort = "25";
// Óʼþ·¢ËÍÕߵĵØÖ·
private String fromAddress;
// Óʼþ½ÓÊÕÕߵĵØÖ·
private String toAddress;
// µÇ½Óʼþ·¢ËÍ·þÎñÆ÷µÄÓû§ÃûºÍÃÜÂë
private String userName;
private String password;
// ÊÇ·ñÐèÒªÉí·ÝÑéÖ¤
private boolean validate = false;
// ÓʼþÖ÷Ìâ
Ïà¹ØÎĵµ£º
XMLÏÖÔÚÒѾ³ÉΪһÖÖͨÓõÄÊý¾Ý½»»»¸ñʽ,ƽ̨µÄÎÞ¹ØÐÔʹµÃºÜ¶à³¡ºÏ¶¼ÐèÒªÓõ½XML¡£±¾ÎĽ«Ïêϸ½éÉÜÓÃJava½âÎöXMLµÄËÄÖÖ·½·¨¡£
XMLÏÖÔÚÒѾ³ÉΪһÖÖͨÓõÄÊý¾Ý½»»»¸ñʽ,ËüµÄƽ̨ÎÞ¹ØÐÔ,ÓïÑÔÎÞ¹ØÐÔ,ϵͳÎÞ¹ØÐÔ,¸øÊý¾Ý¼¯³ÉÓë½»»¥´øÀ´Á˼«´óµÄ·½±ã¡£¶ÔÓÚXML±¾ÉíµÄÓ﷨֪ʶÓë¼¼Êõϸ½Ú,ÐèÒªÔĶÁÏà¹ØµÄ¼¼ÊõÎÄÏ×,ÕâÀïÃæ°üÀ¨µÄÄÚÈÝ ......
http://www.onjava.com
O'ReillyµÄJavaÍøÕ¾. ÿÖܶ¼ÓÐÐÂÎÄÕÂ
http://java.sun.com
¹Ù·½µÄJava¿ª·¢ÕßÍøÕ¾ - ÿÖܶ¼ÓÐÐÂÎÄÕ·¢±í
http://www.developer.com/java
ÓÉGamelan.com ά»¤µÄJava¼¼ÊõÎÄÕÂÍøÕ¾
http://www.java.net
&nb ......
RuntimeExceptionlÀàÐ͵ÄÒì³£Ó¦Óñê×¼µÄ³ÌÐòÉè¼Æ¼¼ÇÉÀ´Ô¤·À£¬¶ø²»ÊÇʹÓÃtry-catch»úÖƲ¶»ñ¡£Òþº¬Òì³£°üº¬ErrorsºÍRuntimeException£¬¶ÔÓÚºóÕßÓÃifÓï¾ä·ÀÖ¹²úÉú¡£Èç·ÃÎÊ¿ÉÄÜδÕýÈ·³õʼ»¯ÒýÓñäÁ¿Ç°£¬Ïȼì²éÊÇ·ñÖ¸Ïò¿ÕÖµ£»·ÃÎÊÊý×éʱ£¬Ïȼì²éϱêÊÇ·ñÔ½½ç¡£
×Ô¶¨ÒåÒì³££º´´½¨Ò»¸ö¼Ì³ÐExceptionµÄÀà»òÆäËûÒÑ´æÔÚµÄ×ÓÀ࣬´´½¨Ò ......
Ê×ÏÈ£¬java¶Ô¶ÔÏóºÍ»ù±¾ÀàÐ͵Ĵ¦ÀíÊDz»Ò»ÑùµÄ£¬ºÍCÓïÑÔÒ»Ñù£¬µ±°ÑJavaµÄ»ù±¾Êý¾ÝÀàÐÍ£¨Èçint£¬char£¬doubleµÈ£©×÷ΪÈë¿Ú²ÎÊý´«¸øº¯ÊýÌåµÄʱºò£¬´«ÈëµÄ²ÎÊýÔÚº¯ÊýÌåÄÚ²¿±ä³ÉÁ˾ֲ¿±äÁ¿£¬Õâ¸ö¾Ö²¿±äÁ¿ÊÇÊäÈë²ÎÊýµÄÒ»¸ö¿½±´£¬ËùÓеĺ¯ÊýÌåÄÚ²¿µÄ²Ù×÷¶¼ÊÇÕë¶ÔÕâ¸ö¿½±´µÄ²Ù×÷£¬º¯ÊýÖ´ÐнáÊøºó£¬Õâ¸ö¾Ö²¿±äÁ¿Ò²¾ÍÍê³ÉÁËËüµÄʹÃü£¬ ......
·Ç³£¼òµ¥,ÔÚC#ÖÐÖ»ÐèÒªÔÚÀàµÄ·½·¨µÄÉÏ·½ÇÃÈýÏÂ"/"¾Í×Ô¶¯°ïÄãÌí¼ÓÏà¹ØµÄ´úÂë,ÄãÖ»Òª°´×ÅÌîд¾Í¿ÉÒÔÁË,¶øJavaÔòÊÇÊäÈë"/**",ËüÒ²»á×Ô¶¯ÐγÉÏà¹Ø´úÂë,¾ßÌå´úÂëÈçÏÂ:
C#
/// <summary>
/// ÔÚ´ËÌîд×ÜÌåÃèÊö
///</summary>
/// <param name="name">ÕâÀïÌîд²ÎÊýnameµÄÃèÊö</param>
public string ......