public final class MailUtils extends Object
Parts of the code copied from Apache ServiceMix.
Modifier and Type | Field and Description |
---|---|
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 String |
PROTOCOL_IMAP |
static String |
PROTOCOL_IMAPS |
static String |
PROTOCOL_NNTP |
static String |
PROTOCOL_POP3 |
static String |
PROTOCOL_POP3S |
static String |
PROTOCOL_SMTP |
static String |
PROTOCOL_SMTPS |
Modifier and Type | Method and Description |
---|---|
static String |
dumpMessage(javax.mail.Message message)
Gets a log dump of the given message that can be used for tracing etc.
|
static String |
getCharSetFromContentType(String contentType)
Gets the charset from the content-type
|
static int |
getDefaultPortForProtocol(String protocol)
Returns the default port for a given protocol.
|
static String |
padContentType(String contentType)
Pads the content-type so it has a space after semi colon that separate pairs.
|
static String |
replaceCharSet(String contentType,
String charset)
Replaces the charset in the content-type
|
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 String PROTOCOL_SMTP
public static final String PROTOCOL_SMTPS
public static final String PROTOCOL_POP3
public static final String PROTOCOL_POP3S
public static final String PROTOCOL_NNTP
public static final String PROTOCOL_IMAP
public static final String PROTOCOL_IMAPS
public static int getDefaultPortForProtocol(String protocol)
If a protocol could not successfully be determined the default port number for SMTP protocol is returned.
protocol
- the protocolpublic static String dumpMessage(javax.mail.Message message)
message
- the Mail messagepublic static String padContentType(String contentType)
contentType
- the content typepublic static String replaceCharSet(String contentType, String charset)
contentType
- the content-typecharset
- the charset to replace, can be null to remove charsetApache Camel