Using the JavaMail API to parse MIME details

Source: Internet
Author: User
Tags mime file
so it can be encapsulated into a mailadaptor.jar.
 Mailadaptor Introduction Mailadaptor is an adapter that is responsible for message access, message resolution, and message generation MIME.
	  
  2# Mailadaptor core function Mailadaptor mainly includes: 
    
     The 
      
  code is as follows copy code
mailinfo loadmailinfo (mailsetting mailsetting, Long CompanyID, String Emlfilepath); Boolean Savemailinfo (Long companyid, String fileservicedir,mailinfo mailinfo);
2.1# Loadmailinfo is primarily responsible for fetching the MIME file's data from the Fileservice and then parsing it, which is displayed by a particular Maildisplay control. The mailsetting parameter is to set the temporary storage directory of the attachment when parsing the message, the display address of the temporary embedded picture attachment, the download address of the temporary ordinary attachment, and the upload URL of the embedded attachment. The Mailsetting property is as follows:------------------------------------------------------------------------------------
   
   
  code is as follows copy code
private String attachmentshowurl = ""; Private String Attachmentdownloadurl = ""; Private String Ckeditoruploadfileurl = ""; Private String Attachmenttempdir = "";
------------------------------------------------------------------------------------CompanyID parameter is the current user's company ID,EMLF The Ilepath parameter is the relative path of the mime file on the Fileservice, which is used to navigate to the absolute path of the mime file on the Fileservice. 2.2# Savemailinfo is primarily responsible for generating MIME files and then storing them on the fileservice. The Mailinfo parameter is the custom entity that collects the message information and is the output of the Mailwrite control. The Mailinfo property is as follows:------------------------------------------------------------------------------------
   
   
  code is as follows copy code
 private String from = "";
     Private String to = "";
     Private date Senddate = new Date ();
     Private String subject = "";
     Private String content = "";
     Private list<attachment> attachmentlist = new arraylist<attachment> (); Private Mailtype Mailtype; 
The------------------------------------------------------------------------------------CompanyID parameter is the company ID of the current user. The Fileservicedir parameter is the directory where the MIME file is specified on the Fileservice, and these two parameters are combined to specify the path of the MIME file to be stored on the fileservice. The whole process Mailadaptor of 3# Mailadaptor is roughly divided into two parts, which is to parse the mime into the mail, and the message to generate MIME. --------------------------------------------------------------------------------------GWT | Mailadaptor | Fileservice | | Fetch MIME File | | | <---------------------| | | | Maildisplay <-----------| | | |-parsing MIME | | | | | | | | | | | | Mailinfo | | Mailwrite----------------> | | | | | | | | | ---------------------------> | | Save a file that generates MIME | | | | | | | |

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.