Õª Òª
×÷ΪһÖÖͨ¹ýÍøÂçʵÏÖÏ໥´«ËͺͽÓÊÕÐÅÏ¢µÄÏÖ´ú»¯Í¨ÐÅ·½Ê½£¬µç×ÓÓʼþÒѳÉΪÈËÃÇÈÕ³£Éú»î¼°¹¤×÷½øÐÐÐÅÏ¢½»»»µÄÖØÒªÔØÌ壬ÊÇÄ¿Ç°InternetÉÏ×î³£ÓõŦÄÜÖ®Ò»¡£
±¾ÂÛÎÄÊÇ»ùÓÚJavaMailµÄ¼òÒ×µç×ÓÓʼþϵͳµÄʵÏÖ£»ÏµÍ³·ÖÎöÖиø³öÁ˵ç×ÓÓʼþ·þÎñÆ÷ºÍµç×ÓÓʼþ¿Í»§¶ËµÄ¼ò½é£¬Í¬Ê±¸ø³öÁ˱¾´ÎÊÔÑéÖпͻ§¶ËµÄÖ÷Òª¹¦ÄܺÍ×ÜÌå¿òͼ¡£
±¾ÏµÍ³ÒÔJavaÓïÑÔ×÷Ϊϵͳ¿ª·¢µÄ»ù´¡ÓïÑÔ£¬ÒÔSUN¹«Ë¾ÌṩµÄJavaMail API±ê×¼¿ª·¢°üÖеĽӿڣ¬×÷ΪjavaÓ¦ÓóÌÐò½øÐÐÊÕ·¢µç×ÓÓʼþµÄ¹«¹²½Ó¿Ú£¬Ê¹Óó£ÓõÄSMTP¼òµ¥Óʼþ´«ÊäÐÒéºÍPOP3ÓʾÖÐÒ飬ʵÏÖÁË°üÀ¨Óû§µÇ¼¡¢Óʼþ·¢ËÍ¡¢Óʼþ½ÓÊÕ¡¢Óʼþ´¦ÀíÒÔ¼°ÁªÏµÈ˹ÜÀíÔÚÄÚµÄÓʼþϵͳµÄ»ù±¾¹¦ÄÜ¡£²¢Í¨¹ýÖð²½²âÊÔ£¬Âú×ãÁËÆÕͨÓû§¶Ôµç×ÓÓʼþϵͳµÄ¼òµ¥ÐèÇó¡£
¹Ø¼ü´Ê£ºJavaMail£»ÓʼþÊÕ·¢ÐÒ飻Óʼþ·þÎñÆ÷£»µç×ÓÓʼþϵͳ
Abstract
As a modern means of communication with each other to send and receive information through the network and people's daily life and work, e-mail has become an important carrier of information exchange as one of the most commonly used functions on the Internet.
This paper is based on the realization of the the JavaMail simple e-mail system; system analysis given in the Introduction of the e-mail server and e-mail client, and gives the main features and the overall block diagram of the test client.
This system use the Java language as the language of the system developed ,using the interface provided by the SUN JavaMail API standard development package ,as a java application to send and receive e-mails public interface , and using the common SMTP Simple Mail Transfer Protocol and POP3 Post Office Protocol , to realize including user login, mail, mail receiving, mail handling and contact management ,as the basic functions of the mail system. By gradually testing to meet the simple needs of ordinary users of the e-mail system.
Keywords: the JavaMail; mail sending and receiving protocol; mail server ; e-mail system
µÚ1Õ Ð÷ ÂÛ
1.1¸ÅÊö
µç×ÓÓʼþ£¨¼ò³ÆE-mail£©ÓֳƵç×ÓÐÅÏä¡¢µç×ÓÓÊÕþ£¬ËüÊÇÒ»ÖÖÓõç×ÓÊÖ¶ÎÌṩÐÅÏ¢½»»»µÄͨÐÅ·½Ê½¡£ÕýÊÇÓÉÓÚµç×ÓÓʼþ¾ßÓÐÊշѵÍÁ®¡¢Ê¹ÓüòÒס¢Í¶µÝѸËÙ¡¢Ò×ÓÚ±£´æ¡¢È«Çò³©Í¨ÎÞ×èµÈÓÅÓÚ´«Í³ÓʼþµÄÌØÐÔ£¬Ê¹µÃËü³ÉΪInternetÉÏ×î¹ã·ºµÄÓ¦ÓÃÖ®Ò»£¬ËüʹÈËÃǵĽ»Á÷·½Ê½µÃµ½Á˼«´óµÄ¸Ä±ä¡£ÁíÍ⣬µç×ÓÓʼþ»¹¿ÉÒÔ½øÐÐÒ»¶Ô¶àµÄÓʼþ´«µÝ£¬Í¬Ò»Óʼþ¿ÉÒÔÒ»´Î·¢Ë͸øÐí¶àÈË¡£¼«´óµØÂú×ãÁË´óÁ¿´æÔÚµÄÈËÓëÈËÖ®¼äͨÐŵÄÐèÇó¡£
µç×ÓÓʼþͨÐÅÊôÒ첽ͨÐÅ£¬ËùνÒ첽ͨÐÅÊÇÖ¸£ºÊÕ·¢Ë«·½²»±ØͬʱÔÚ³¡£¬·¢ËͺͽÓÊÕµÄÓʼþÔÝʱ´æÖüÔÚµç×ÓÓÊÏäÖУ¬Óû§¿ÉÒÔ¸ù¾ÝÐèÒª£¬ÊÊʱµØ½øÐÐÓʼþµÄ·¢ËͺͲéÊÕ£¬ÕâÖÖ·ÇʵʱµÄͨÐÅ·½Ê½£¬Ò²ÕýÊǵç×ÓÓʼþϵͳµÄºËÐÄ¡£
1.2¿ª·¢ÒâÒå¼°¹úÄÚÏÖ×´
µç×ÓÓʼþE-mailÊÇInternet×î»ù±¾µÄºÍ×îÖØÒªµÄ·þÎñÖ®Ò»¡£¾Ýͳ¼Æ£¬InternetÉÏ°Ù·ÖÖ®ÈýÊ®ÒÔÉϵÄÒµÎñÁ¿Êǵç×ÓÓʼþ¡£ÓÉÓÚÎÒ¹úµÄͨÐÅ»ù´¡ÉèÊ©½Ï²î£¬ÍøÂçËٶȽÏÂý£¬Òò¶ø£¬ÓëInternetÆäËü¹¦ÄÜÈçWWW¡¢FTP¡¢NEWSµÈÏà±È£¬µç×ÓÓʼþ·þÎñ¾ßÓиü´óµÄʵÓÃÐÔ¡£¡¶CINNICÖйú»¥ÁªÍøÍøÂç·¢Õ¹×´¿öͳ¼Æ±¨¸æ¡·ÖÐÖ¸³ö¡£71.65%µÄÖйúÓû§×î³£ÓõÄÍøÂç·þÎñ¾ÍÊǵç×ÓÓʼþ£¬Õâ¸ö±ÈÀýÔ¶Ô¶¸ßÓÚËÑË÷ÒýÇ棨50.40%£©ºÍÈí¼þÉÏ´«»òÏÂÔØ·þÎñ£¨44.16%£©µÈÆäËû·þÎñ¡£
1.3ϵͳÌصã
±¾ÏµÍ³·ÖÎöÖиø³öÁ˵ç×ÓÓʼþ·þÎñÆ÷ºÍµç×ÓÓʼþ¿Í»§¶ËµÄ¼ò½é£¬Í¬Ê±¸ø³öÁ˱¾´ÎÊÔÑéÖпͻ§¶ËµÄÖ÷Òª¹¦ÄܺÍ×ÜÌå¿òͼ¡£Óʼþ·þÎñÆ÷°´ÕÕÌṩµÄ·þÎñÀàÐÍ£¬¿ÉÒÔ·ÖΪ·¢ËÍÓʼþ·þÎñÆ÷£¨¼ò³Æ·¢ËÍ·þÎñÆ÷£©ºÍ½ÓÊÕÓʼþ·þÎñÆ÷£¨¼ò³Æ½ÓÊÕ·þÎñÆ÷£©¡£·¢ËÍÓʼþ·þÎñÆ÷ʹÓÃÓʼþ·¢ËÍÐÒ飬ÏÖÔÚ³£ÓõÄÊÇSMTP£¬ËùÒÔͨ³£·¢ËÍÓʼþ·þÎñÆ÷Ò²³ÆΪSMTP·þÎñÆ÷£»½ÓÊÕÓʼþ·þÎñÆ÷ʹÓÃÓʼþ½ÓÊÕÐÒ飬³£ÓõÄÓÐPOP3ºÍIMAPÐÒ飬ËùÒÔͨ³£½ÓÊÕÓʼþ·þÎñÆ÷Ò²³ÆΪPOP3·þÎñÆ÷»òIMAP·þÎñÆ÷¡£
SMTP £¨ Simple Mail Transfer Protocol £©£¬¼´¼òµ¥Óʼþ´«ÊäÐÒ飬ÊÇInternet´«ËÍE-mailµÄ»ù±¾ÐÒ飬ҲÊÇTCP/IPÐÒé×éµÄ³ÉÔ±¡£SMTPÐÒé½â¾öÓʼþϵͳÈçºÎͨ¹ýÒ»ÌõÁ´Â·£¬°ÑÓʼþ´Óһ̨»úÆ÷´«Ë͵½Áíһ̨»úÆ÷ÉϵÄÎÊÌâ¡£SMTPÐÒéµÄÌصãÊǾßÓÐÁ¼ºÃµÄ¿ÉÉìËõÐÔ£¬ÕâÒ²ÊÇËü³É¹¦µÄ¹Ø¼ü¡£SMTPÐÒéÓÉÓڷdz£¼òµ¥£¬ÓÖͬʱÊÊÓÃÓÚ¹ãÓòÍøºÍ¾ÖÓòÍø£¬Ê¹ËüµÃµ½Á˹㷺µÄÔËÓã¬InternetÉÏÄܹ»·¢ËÍÓʼþµÄ·þÎñÆ÷¼¸ºõ¶¼Ö§³ÖSMTPÐÒé¡£
POP3 £¨Post Office Protocol 3£©£¬¼´ÓʾÖÐÒéµÚÈý°æ£¬ÊÇInternet½ÓÊÕÓʼþµÄ»ù±¾ÐÒ飬ҲÊÇTCP/IPÐÒé×éµÄ³ÉÔ±¡£RFC1939ÃèÊöÁËPOP3ÐÒ飬ÍøַΪ¡°http://www.ietf.org/rfc/rfc1939.txt¡±¡£
POP3¼ÈÔÊÐí½ÓÊÕÓʼþ·þÎñÆ÷ÏòÓʼþÓû§·¢ËÍÓʼþ£¬Ò²¿ÉÒÔ½ÓÊÕÀ´×ÔSMTP·þÎñÆ÷µÄÓʼþ¡£Óʼþ¿Í»§¶ËÈí¼þ»áÓëPOP3·þÎñÆ÷½»»¥£¬ÏÂÔØÓÉPOP3·þÎñÆ÷½ÓÊÕµ½µÄÓʼþ¡£»ùÓÚPOP3ÐÒéµÄÓʼþϵͳÄÜÌṩ¿ìËÙ¡¢¾¼ÃºÍ·½±ãµÄÓʼþ½ÓÊÕ·þÎñ£¬ÉîÊÜÓû§µÄÇàíù¡£