Java MailÎÞ·¨½âÎö´ø·ÖºÅµÄÊÕ¼þÈËÁбíµÄÎÊÌâ
Java MailÎÞ·¨½âÎö´ø·ÖºÅµÄÊÕ¼þÈËÁбíµÄÎÊÌâ
½ñÌìͬÊÂÅöµ½Ò»¸öÎÊÌ⣬ʹÓÃJAVA MAILÊÕÈ¡Óʼþʱ£¬Èç¹ûÊÕ¼þÈËÊǸöÁÐ±í£¬ÇÒÊÕ¼þÈËÁбíÊÇÒԷֺŽøÐзָîµÄ£¬ÔòJAVA MAIL¾Í»á³öÏÖÒì³££¬²»ÄÜÕý³£½âÎö£¬³é¿Õ¿´ÁËÒ»ÑÛ£¬×Ô¼ºÐ´Á˸ö¼òµ¥demo£¬ºÜ¼òµ¥£¬ÀýÈ磺
@Test
public void testReceiveMail() {
try {
String host = "pop3.163.com";
Properties pops = new Properties();
pops.put("mail.pop3.host", host);
pops.put("mail.pop.auth", "true");
Session session = Session.getDefaultInstance(pops, null);
Store store = session.getStore("pop3");
//Á¬½ÓÓʼþ·þÎñÆ÷
store.connect(host, "chb_go", "3870359346");
//ÊÕÈ¡ÊÕ¼þÏä
Folder inbox = store.getDefaultFolder().getFolder("INBOX");
//Ö»¶Á×ã¹»ÁË
inbox.open(Folder.READ_ONLY);
//µÃµ½ËùÓÐÓʼþÁбí
Message[] msg = inbox.getMessages();
FetchProfile profile = new FetchProfile();
profile.add(FetchProfile.Item.ENVELOPE);
inbox.fetch(msg, profile);
for (int i = 0; i < msg.length; i++) {
System.out.println("===============================================");
System.out.println("Ö÷Ì⣺"+msg[i].getSubject());
InternetAddress[] toAddress = (InternetAddress[]) msg[i].getRecipients(Message.RecipientType.TO);
for(InternetAddress adress:toAddress){
System.out.println(adress.getAddress());
}
}
//¹Ø±Õ´ò¿ªµÄ
Ïà¹ØÎĵµ£º
ÇëÎʸ÷λ´ó룬Èç¹ûÓÃJAVAÀ´ÖÆ×÷¶¯Ì¬µÄ¸öÈËÍøÕ¾£¬¶¼ÐèÒªÄÄЩ·½ÃæµÄ֪ʶºÍ×¼±¸¹¤×÷£¿¿ª·¢¹¤¾ßʹÓÃʲô±È½ÏºÃ£¬Eclipse»¹ÊÇMyEclipse¡¢»¹ÊÇNetBeans£¿Çë¸ßÊÖÖ¸½Ì……
ÒÔǰÓÃEclipse×ö¹ý¹«Ë¾µÄÍøÕ¾£¬Ê±¼ä¸ôµÄÓÐЩ̫¾ÃÁË¡¢¶¼Íü¼ÇÊÇÔõÑùÒ»¸ö¹ý³ÌÁË¡£JSP¡¢SERLET¡¢HIBERNATE¡ ......
³õ̽javaÄÚ´æ»úÖÆ_¶ÑºÍÕ»
ÎÊÌâµÄÒýÈ룺
ÎÊÌâÒ»£º
String str1 = "abc";
String str2 = "abc";
System.out.println(str1==str2); //true
ÎÊÌâ¶þ£º
String str1 =new String ("abc");
String str2 =new String ("abc");
System.out.println(str1==str2); // false
ÎÊÌâÈý£º
String s1 = "ja";
String s2 = "v ......
package tf;
public class TestPack {
public static void main(String [] args)
{
try
{
IAnimal cAnimal = new bird();
cAnimal.shout();
IAnimal animal =(IAnimal)java.lang.Class ......
Today , i take the first lesson of java ,let me sum up the details:
firstly,about jdk and jre.jdk stands for java development kit,while jre represent java Runtime Environment. jdk is the key of Java. And,jvm(java virtual machine) is the key of jre.
then ,about the platform independence of java.Dur ......