In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to use JavaMail API to parse MIME, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
I didn't know what MIME was before, but after a period of research, it was generally understood as a standard format for receiving and sending e-mail.
Only by understanding this standard can we parse the contents of the mail received by the mail server and send the new mail in the standard format of MIME, so that other mail servers can parse it correctly.
So it can be encapsulated into a mailadaptor.jar.
1. Introduction to MailAdaptor
MailAdaptor is an adapter that is responsible for mail access, mail parsing, and mail generation MIME.
2. MailAdaptor core function
MailAdaptor mainly includes:
MailInfo loadMailInfo (MailSetting mailSetting, Long companyId,String emlFilePath); Boolean saveMailInfo (Long companyId,String fileServiceDir,MailInfo mailInfo)
1) loadMailInfo is mainly responsible for fetching the data of the MIME file from the FileService, then parsing it out and displaying it by a specific MailDisplay control.
MailSetting parameter is to set the temporary storage directory of attachments when parsing emails, the display address of temporary embedded image attachments, the download address of temporary ordinary attachments, and the upload Url of new embedded attachments.
The MailSetting attribute is as follows:
Private String attachmentShowUrl = "; private String attachmentDownloadUrl ="; private String ckEditorUploadFileUrl ="; private String attachmentTempDir ="
The companyId parameter is the current user's company ID,emlFilePath parameter is the relative path of the MIME file on the FileService, and the combination of these two parameters is used to locate the absolute path of the MIME file on the FileService.
2) saveMailInfo is mainly responsible for generating MIME files and then storing them on FileService.
The MailInfo parameter is a custom entity that collects mail information and is the output of the MailWrite control.
The MailInfo attribute is as follows:
Private String from = ""; private String to = ""; private Date sendDate = new Date (); private String subject = ""; private String content = ""; private List attachmentList = new ArrayList (); private MailType mailType
The companyId parameter is the company ID,fileServiceDir parameter of the current user. The ID,fileServiceDir parameter specifies the directory where the MIME file is stored on the FileService. The combination of these two parameters is used to specify the storage path of the MIME file on the FileService.
3. The overall process of MailAdaptor
MailAdaptor is generally divided into two parts: taking MIME to parse into mail, and mail to generate MIME.
GWT | MailAdaptor | FileService | | fetch MIME file | Save the generated MIME file | | | the above content is how to parse MIME using JavaMail API | Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.