Package org.apache.camel.component.mail
Class MailUtils
- java.lang.Object
-
- org.apache.camel.component.mail.MailUtils
-
public final class MailUtils extends Object
Mail utility class.Parts of the code copied from Apache ServiceMix.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_PORT_IMAPstatic intDEFAULT_PORT_IMAPSstatic intDEFAULT_PORT_NNTPstatic intDEFAULT_PORT_POP3static intDEFAULT_PORT_POP3Sstatic intDEFAULT_PORT_SMTPstatic intDEFAULT_PORT_SMTPSstatic StringPROTOCOL_IMAPstatic StringPROTOCOL_IMAPSstatic StringPROTOCOL_NNTPstatic StringPROTOCOL_POP3static StringPROTOCOL_POP3Sstatic StringPROTOCOL_SMTPstatic StringPROTOCOL_SMTPS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringdumpMessage(javax.mail.Message message)Gets a log dump of the given message that can be used for tracing etc.static StringgetCharSetFromContentType(String contentType)Gets the charset from the content-typestatic intgetDefaultPortForProtocol(String protocol)Returns the default port for a given protocol.static StringpadContentType(String contentType)Pads the content-type so it has a space after semi colon that separate pairs.static StringreplaceCharSet(String contentType, String charset)Replaces the charset in the content-type
-
-
-
Field Detail
-
DEFAULT_PORT_SMTP
public static final int DEFAULT_PORT_SMTP
- See Also:
- Constant Field Values
-
DEFAULT_PORT_SMTPS
public static final int DEFAULT_PORT_SMTPS
- See Also:
- Constant Field Values
-
DEFAULT_PORT_POP3
public static final int DEFAULT_PORT_POP3
- See Also:
- Constant Field Values
-
DEFAULT_PORT_POP3S
public static final int DEFAULT_PORT_POP3S
- See Also:
- Constant Field Values
-
DEFAULT_PORT_NNTP
public static final int DEFAULT_PORT_NNTP
- See Also:
- Constant Field Values
-
DEFAULT_PORT_IMAP
public static final int DEFAULT_PORT_IMAP
- See Also:
- Constant Field Values
-
DEFAULT_PORT_IMAPS
public static final int DEFAULT_PORT_IMAPS
- See Also:
- Constant Field Values
-
PROTOCOL_SMTP
public static final String PROTOCOL_SMTP
- See Also:
- Constant Field Values
-
PROTOCOL_SMTPS
public static final String PROTOCOL_SMTPS
- See Also:
- Constant Field Values
-
PROTOCOL_POP3
public static final String PROTOCOL_POP3
- See Also:
- Constant Field Values
-
PROTOCOL_POP3S
public static final String PROTOCOL_POP3S
- See Also:
- Constant Field Values
-
PROTOCOL_NNTP
public static final String PROTOCOL_NNTP
- See Also:
- Constant Field Values
-
PROTOCOL_IMAP
public static final String PROTOCOL_IMAP
- See Also:
- Constant Field Values
-
PROTOCOL_IMAPS
public static final String PROTOCOL_IMAPS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefaultPortForProtocol
public static int getDefaultPortForProtocol(String protocol)
Returns the default port for a given protocol.If a protocol could not successfully be determined the default port number for SMTP protocol is returned.
- Parameters:
protocol- the protocol- Returns:
- the default port
-
dumpMessage
public static String dumpMessage(javax.mail.Message message)
Gets a log dump of the given message that can be used for tracing etc.- Parameters:
message- the Mail message- Returns:
- a log string with important fields dumped
-
padContentType
public static String padContentType(String contentType)
Pads the content-type so it has a space after semi colon that separate pairs. This is needed as some mail servers will choke otherwise- Parameters:
contentType- the content type- Returns:
- the padded content type
-
replaceCharSet
public static String replaceCharSet(String contentType, String charset)
Replaces the charset in the content-type- Parameters:
contentType- the content-typecharset- the charset to replace, can be null to remove charset- Returns:
- the content-type with replaced charset
-
-