public final class MailUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONNECTION_TIMEOUT |
static int |
DEFAULT_PORT_IMAP |
static int |
DEFAULT_PORT_IMAPS |
static int |
DEFAULT_PORT_NNTP |
static int |
DEFAULT_PORT_POP3 |
static int |
DEFAULT_PORT_POP3S |
static int |
DEFAULT_PORT_SMTP |
static int |
DEFAULT_PORT_SMTPS |
static java.lang.String |
KEY_BODY_HTML |
static java.lang.String |
KEY_BODY_TEXT |
static java.lang.String |
PROTOCOL_IMAP |
static java.lang.String |
PROTOCOL_IMAPS |
static java.lang.String |
PROTOCOL_NNTP |
static java.lang.String |
PROTOCOL_POP |
static java.lang.String |
PROTOCOL_POP3 |
static java.lang.String |
PROTOCOL_POP3S |
static java.lang.String |
PROTOCOL_SMTP |
static java.lang.String |
PROTOCOL_SMTPS |
static java.lang.String |
SSL_FACTORY |
| Modifier and Type | Method and Description |
|---|---|
static MailConnectionConfiguration |
configure(java.lang.String uriString)
parse the connection details via given uri
|
static void |
extractAttachmentsFromMail(javax.jbi.messaging.NormalizedMessage nmsg,
javax.mail.internet.MimeMessage mailMsg)
extracts the attachments from the mail
|
static void |
extractAttachmentsFromMultipart(javax.mail.Multipart mp,
javax.jbi.messaging.NormalizedMessage nmsg)
extracts attachments from a multipart mail part
|
static java.lang.Object |
extractBodyFromMail(javax.mail.Message message)
Extracts the body from the Mail message
|
static void |
extractBodyFromMail(javax.jbi.messaging.NormalizedMessage nmsg,
javax.mail.internet.MimeMessage mailMsg)
extracts the body from the mail
|
static java.util.Map<java.lang.String,java.lang.String> |
extractBodyFromMultipart(javax.mail.Multipart mp,
javax.jbi.messaging.NormalizedMessage nmsg)
returns the body of the mail
|
static void |
extractHeadersFromMail(javax.jbi.messaging.NormalizedMessage nmsg,
javax.mail.internet.MimeMessage mailMsg)
copy the headers of the mail message into the normalized message headers
|
static int |
getDefaultPortForProtocol(java.lang.String protocol)
returns the default port for a given protocol
|
static java.util.Properties |
getPropertiesForProtocol(MailConnectionConfiguration config,
java.lang.String customTrustManagers)
returns the connection properties for use in endpoints
|
static void |
parsePart(javax.mail.internet.MimeBodyPart mbp,
javax.jbi.messaging.NormalizedMessage nmsg)
extracts and parses the attachments found in the mail bodies and puts
them to the normalized message attachments
|
public static final java.lang.String KEY_BODY_TEXT
public static final java.lang.String KEY_BODY_HTML
public static final java.lang.String SSL_FACTORY
public static final int DEFAULT_PORT_SMTP
public static final int DEFAULT_PORT_SMTPS
public static final int DEFAULT_PORT_POP3
public static final int DEFAULT_PORT_POP3S
public static final int DEFAULT_PORT_NNTP
public static final int DEFAULT_PORT_IMAP
public static final int DEFAULT_PORT_IMAPS
public static final java.lang.String PROTOCOL_SMTP
public static final java.lang.String PROTOCOL_SMTPS
public static final java.lang.String PROTOCOL_POP
public static final java.lang.String PROTOCOL_POP3
public static final java.lang.String PROTOCOL_POP3S
public static final java.lang.String PROTOCOL_NNTP
public static final java.lang.String PROTOCOL_IMAP
public static final java.lang.String PROTOCOL_IMAPS
public static final java.lang.String CONNECTION_TIMEOUT
public static int getDefaultPortForProtocol(java.lang.String protocol)
protocol - the protocolpublic static MailConnectionConfiguration configure(java.lang.String uriString) throws javax.mail.internet.ParseException
uriString - the uri used for connectionjavax.mail.internet.ParseException - if the uri couldn't be parsedpublic static java.util.Properties getPropertiesForProtocol(MailConnectionConfiguration config, java.lang.String customTrustManagers)
config - the connection configurationcustomTrustManagers - the custom trust manager(s)public static java.lang.Object extractBodyFromMail(javax.mail.Message message)
message - the mail messagepublic static void extractHeadersFromMail(javax.jbi.messaging.NormalizedMessage nmsg,
javax.mail.internet.MimeMessage mailMsg)
throws javax.mail.MessagingException
nmsg - the message to usemailMsg - the mail messagejavax.mail.MessagingException - on any errorspublic static void extractAttachmentsFromMultipart(javax.mail.Multipart mp,
javax.jbi.messaging.NormalizedMessage nmsg)
throws javax.mail.MessagingException,
javax.jbi.messaging.MessagingException,
java.io.IOException
mp - the multipartnmsg - the normalized messagejavax.mail.MessagingException - on mail errorsjavax.jbi.messaging.MessagingException - on jbi messaging errorsjava.io.IOException - on io errorspublic static java.util.Map<java.lang.String,java.lang.String> extractBodyFromMultipart(javax.mail.Multipart mp,
javax.jbi.messaging.NormalizedMessage nmsg)
throws javax.mail.MessagingException,
java.io.IOException
mp - the multipartnmsg - the normalized messagejavax.mail.MessagingException - on mail message errorsjava.io.IOException - on io errorspublic static void parsePart(javax.mail.internet.MimeBodyPart mbp,
javax.jbi.messaging.NormalizedMessage nmsg)
throws javax.jbi.messaging.MessagingException,
javax.mail.MessagingException,
java.io.IOException
mbp - the mime body part to parsenmsg - the normalized message to filljavax.jbi.messaging.MessagingException - on messaging errorsjavax.mail.MessagingException - on mail message errorsjava.io.IOException - on io errorspublic static void extractBodyFromMail(javax.jbi.messaging.NormalizedMessage nmsg,
javax.mail.internet.MimeMessage mailMsg)
throws javax.mail.MessagingException,
javax.jbi.messaging.MessagingException
nmsg - the normalized messagemailMsg - the mail messagejavax.jbi.messaging.MessagingException - on messaging errorsjavax.mail.MessagingException - on mail message errorspublic static void extractAttachmentsFromMail(javax.jbi.messaging.NormalizedMessage nmsg,
javax.mail.internet.MimeMessage mailMsg)
nmsg - the normalized messagemailMsg - the mail messageCopyright © 2005-2015 FuseSource. All Rights Reserved.