Summary of JavaMail operations (5)

xiaoxiao2021-03-06  101

// This procedure is used to accept messages with information html void jButton7_actionPerformed (ActionEvent e) {try {Properties props = System.getProperties (); Authenticator auth = new Email_Autherticator (); props.put ( "mail.smtp.host" , Host); Props.Put ("mail.smtp.auth", "true"); session session = session.getDefaultinstance (props, auth); store store = session.getStore; store.connect (Host); store.connect , Username, Password); // After Connecting to the Store, You Can Get A Folder, Which Must Be Opened Before You Can Read Messages from It: Folder Folder = Store.getFolder ("Inbox"); Folder.Open (Folder). Read_write; Message Message [] = folder.getMess (); for (int i = 0, n = message.Length; I // for (INT i = 0, n = 1; i {string out_from_person = ((InternetAddress) Message [i] .GetFrom () [0]). getPersonal (); string out_from_address = ((Internetdress) message [i] .GetFrom () [0]). getAddress (); system.out.println ("from: " OUT_FROM_PERSON " / T "); System.out.Println (" Address: " Out_FROM_ADDRESS " / T "); string out_subject = message [i] .getsubject (); system.out.println (" Subject: " OUT_SUBJECT " / T "); // Get information information, and operates each part of it part messagepart = message [i]; Object out_content = messagepart.getContent (); if (out_content instanceof multipart {messagepart = (Multipart) out_content) .getBodyPart (0); System.out.println ( "[Multipart Message]");} String out_content_type = messagePart.getContentType (); System.out.println ( "CONTENT:" out_content_type); jEditorPane1 .setText (""); // Displayed it in JeditorPanel on JeditorPane1.setContentType ("text / html"); jeditorpane1.settext (String) OUT_CONTENT;

转载请注明原文地址:https://www.9cbs.com/read-126867.html

New Post(0)