Class IMAPImportMbox
java.lang.Object
org.apache.commons.net.examples.mail.IMAPImportMbox
This is an example program demonstrating how to use the IMAP[S]Client class. This program connects to a IMAP[S] server and imports messages into the folder
from an mbox file.
Usage: IMAPImportMbox imap[s]://user:password@host[:port]/folder/path
An example selector might be:
For example:
IMAPImportMbox imaps://user:pass@imap.googlemail.com/imported_messages 201401.mbox 1-10,20 -142986-
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
private static boolean
listContains
(List<String> contains, String string) Is at least one entry in the list contained in the string?static void
private static boolean
process
(StringBuilder sb, IMAPClient imap, String folder, int msgNum) private static boolean
startsWith
(String input, Pattern pat) private static boolean
Is the message wanted?
-
Field Details
-
CRLF
- See Also:
-
PATFROM
-
-
Constructor Details
-
IMAPImportMbox
public IMAPImportMbox()
-
-
Method Details
-
getDate
-
listContains
Is at least one entry in the list contained in the string?- Parameters:
contains
- the list of strings to look forstring
- the String to check against- Returns:
- true if at least one entry in the contains list is contained in the string
-
main
- Throws:
IOException
-
process
private static boolean process(StringBuilder sb, IMAPClient imap, String folder, int msgNum) throws IOException - Throws:
IOException
-
startsWith
-
wanted
Is the message wanted?- Parameters:
msgNum
- the message numberline
- the From linemsgNums
- the list of wanted message numberscontains
- the list of strings to be contained- Returns:
- true if the message is wanted
-