Package org.apache.camel.component.mail
Class MailBinding
java.lang.Object
org.apache.camel.component.mail.MailBinding
A Strategy used to convert between a Camel
Exchange
and Message
to and from a Mail
MimeMessage
-
Constructor Summary
ConstructorsConstructorDescriptionMailBinding
(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy, ContentTypeResolver contentTypeResolver, boolean decodeFilename) Deprecated.MailBinding
(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy, ContentTypeResolver contentTypeResolver, boolean decodeFilename, boolean mapMailMessage) MailBinding
(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy, ContentTypeResolver contentTypeResolver, boolean decodeFilename, boolean mapMailMessage, boolean failOnDuplicateAttachment) MailBinding
(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy, ContentTypeResolver contentTypeResolver, boolean decodeFilename, boolean mapMailMessage, boolean failOnDuplicateAttachment, String generateMissingAttachmentNames, String handleDuplicateAttachmentNames) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAttachmentsToMultipart
(jakarta.mail.internet.MimeMultipart multipart, String partDisposition, AttachmentsContentTransferEncodingResolver encodingResolver, org.apache.camel.Exchange exchange) protected void
addBodyToMultipart
(MailConfiguration configuration, jakarta.mail.internet.MimeMultipart activeMultipart, org.apache.camel.Exchange exchange) protected void
appendAttachmentsFromCamel
(jakarta.mail.internet.MimeMessage mimeMessage, MailConfiguration configuration, org.apache.camel.Exchange exchange) Appends the Mail attachments from the CamelMailMessage
protected void
appendHeadersFromCamelMessage
(jakarta.mail.internet.MimeMessage mimeMessage, MailConfiguration configuration, org.apache.camel.Exchange exchange) Appends the Mail headers from the CamelMailMessage
protected void
createMultipartAlternativeMessage
(jakarta.mail.internet.MimeMessage mimeMessage, MailConfiguration configuration, org.apache.camel.Exchange exchange) protected static String
determineCharSet
(MailConfiguration configuration, org.apache.camel.Exchange exchange) protected String
determineContentType
(MailConfiguration configuration, org.apache.camel.Exchange exchange) void
extractAttachmentsFromMail
(jakarta.mail.Message message, Map<String, org.apache.camel.attachment.Attachment> map) Parses the attachments of the given mail message and adds them to the mapprotected void
extractAttachmentsFromMultipart
(jakarta.mail.Multipart mp, Map<String, org.apache.camel.attachment.Attachment> map) extractBodyFromMail
(org.apache.camel.Exchange exchange, MailMessage mailMessage) Extracts the body from the Mail messageextractHeadersFromMail
(jakarta.mail.Message mailMessage, org.apache.camel.Exchange exchange) protected static String
getAlternativeBody
(MailConfiguration configuration, org.apache.camel.Exchange exchange) protected void
handleDuplicateFileAttachment
(jakarta.mail.Multipart mp, String duplicateFileName) Strategy for handling extracting mail message that has duplicate file attachmentsprotected static boolean
hasAlternativeBody
(MailConfiguration configuration, org.apache.camel.Exchange exchange) boolean
protected String
populateContentOnBodyPart
(jakarta.mail.BodyPart part, MailConfiguration configuration, org.apache.camel.Exchange exchange) protected String
populateContentOnMimeMessage
(jakarta.mail.internet.MimeMessage part, MailConfiguration configuration, org.apache.camel.Exchange exchange) void
populateMailMessage
(MailEndpoint endpoint, jakarta.mail.internet.MimeMessage mimeMessage, org.apache.camel.Exchange exchange) protected void
resolveContentTransferEncoding
(AttachmentsContentTransferEncodingResolver resolver, int i, jakarta.mail.BodyPart messageBodyPart) void
setFailOnDuplicateAttachment
(boolean failOnDuplicateAttachment) void
setGenerateMissingAttachmentNames
(String generateMissingAttachmentNames) void
setHandleDuplicateAttachmentNames
(String handleDuplicateAttachmentNames) protected void
setRecipientFromEndpointConfiguration
(jakarta.mail.internet.MimeMessage mimeMessage, MailEndpoint endpoint, org.apache.camel.Exchange exchange) Appends the Mail headers from the endpoint configuration.protected boolean
Strategy to allow filtering of attachments which are added on the Mail message
-
Constructor Details
-
MailBinding
public MailBinding() -
MailBinding
@Deprecated public MailBinding(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy, ContentTypeResolver contentTypeResolver, boolean decodeFilename) Deprecated. -
MailBinding
public MailBinding(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy, ContentTypeResolver contentTypeResolver, boolean decodeFilename, boolean mapMailMessage) -
MailBinding
public MailBinding(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy, ContentTypeResolver contentTypeResolver, boolean decodeFilename, boolean mapMailMessage, boolean failOnDuplicateAttachment) -
MailBinding
public MailBinding(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy, ContentTypeResolver contentTypeResolver, boolean decodeFilename, boolean mapMailMessage, boolean failOnDuplicateAttachment, String generateMissingAttachmentNames, String handleDuplicateAttachmentNames)
-
-
Method Details
-
isFailOnDuplicateAttachment
public boolean isFailOnDuplicateAttachment() -
setFailOnDuplicateAttachment
public void setFailOnDuplicateAttachment(boolean failOnDuplicateAttachment) -
populateMailMessage
public void populateMailMessage(MailEndpoint endpoint, jakarta.mail.internet.MimeMessage mimeMessage, org.apache.camel.Exchange exchange) throws jakarta.mail.MessagingException, IOException - Throws:
jakarta.mail.MessagingException
IOException
-
determineContentType
protected String determineContentType(MailConfiguration configuration, org.apache.camel.Exchange exchange) -
determineCharSet
protected static String determineCharSet(MailConfiguration configuration, org.apache.camel.Exchange exchange) -
populateContentOnMimeMessage
protected String populateContentOnMimeMessage(jakarta.mail.internet.MimeMessage part, MailConfiguration configuration, org.apache.camel.Exchange exchange) throws jakarta.mail.MessagingException, IOException - Throws:
jakarta.mail.MessagingException
IOException
-
populateContentOnBodyPart
protected String populateContentOnBodyPart(jakarta.mail.BodyPart part, MailConfiguration configuration, org.apache.camel.Exchange exchange) throws jakarta.mail.MessagingException, IOException - Throws:
jakarta.mail.MessagingException
IOException
-
extractBodyFromMail
Extracts the body from the Mail message -
extractAttachmentsFromMail
public void extractAttachmentsFromMail(jakarta.mail.Message message, Map<String, org.apache.camel.attachment.Attachment> map) throws jakarta.mail.MessagingException, IOExceptionParses the attachments of the given mail message and adds them to the map- Parameters:
message
- the mail message with attachmentsmap
- the map to add found attachments (attachmentFilename is the key)- Throws:
jakarta.mail.MessagingException
IOException
-
extractAttachmentsFromMultipart
protected void extractAttachmentsFromMultipart(jakarta.mail.Multipart mp, Map<String, org.apache.camel.attachment.Attachment> map) throws jakarta.mail.MessagingException, IOException- Throws:
jakarta.mail.MessagingException
IOException
-
handleDuplicateFileAttachment
protected void handleDuplicateFileAttachment(jakarta.mail.Multipart mp, String duplicateFileName) throws jakarta.mail.MessagingException Strategy for handling extracting mail message that has duplicate file attachments- Parameters:
mp
- the multipart entityduplicateFileName
- the duplicated file name- Throws:
jakarta.mail.MessagingException
- is thrown, failing with an error
-
appendHeadersFromCamelMessage
protected void appendHeadersFromCamelMessage(jakarta.mail.internet.MimeMessage mimeMessage, MailConfiguration configuration, org.apache.camel.Exchange exchange) throws jakarta.mail.MessagingException, IOException Appends the Mail headers from the CamelMailMessage
- Throws:
jakarta.mail.MessagingException
IOException
-
setRecipientFromEndpointConfiguration
protected void setRecipientFromEndpointConfiguration(jakarta.mail.internet.MimeMessage mimeMessage, MailEndpoint endpoint, org.apache.camel.Exchange exchange) throws jakarta.mail.MessagingException, IOException Appends the Mail headers from the endpoint configuration.- Throws:
jakarta.mail.MessagingException
IOException
-
appendAttachmentsFromCamel
protected void appendAttachmentsFromCamel(jakarta.mail.internet.MimeMessage mimeMessage, MailConfiguration configuration, org.apache.camel.Exchange exchange) throws jakarta.mail.MessagingException, IOException Appends the Mail attachments from the CamelMailMessage
- Throws:
jakarta.mail.MessagingException
IOException
-
addAttachmentsToMultipart
protected void addAttachmentsToMultipart(jakarta.mail.internet.MimeMultipart multipart, String partDisposition, AttachmentsContentTransferEncodingResolver encodingResolver, org.apache.camel.Exchange exchange) throws jakarta.mail.MessagingException - Throws:
jakarta.mail.MessagingException
-
resolveContentTransferEncoding
protected void resolveContentTransferEncoding(AttachmentsContentTransferEncodingResolver resolver, int i, jakarta.mail.BodyPart messageBodyPart) throws jakarta.mail.MessagingException - Throws:
jakarta.mail.MessagingException
-
createMultipartAlternativeMessage
protected void createMultipartAlternativeMessage(jakarta.mail.internet.MimeMessage mimeMessage, MailConfiguration configuration, org.apache.camel.Exchange exchange) throws jakarta.mail.MessagingException, IOException - Throws:
jakarta.mail.MessagingException
IOException
-
addBodyToMultipart
protected void addBodyToMultipart(MailConfiguration configuration, jakarta.mail.internet.MimeMultipart activeMultipart, org.apache.camel.Exchange exchange) throws jakarta.mail.MessagingException, IOException - Throws:
jakarta.mail.MessagingException
IOException
-
shouldAddAttachment
protected boolean shouldAddAttachment()Strategy to allow filtering of attachments which are added on the Mail message -
extractHeadersFromMail
protected Map<String,Object> extractHeadersFromMail(jakarta.mail.Message mailMessage, org.apache.camel.Exchange exchange) throws jakarta.mail.MessagingException, IOException - Throws:
jakarta.mail.MessagingException
IOException
-
hasAlternativeBody
protected static boolean hasAlternativeBody(MailConfiguration configuration, org.apache.camel.Exchange exchange) -
getAlternativeBody
protected static String getAlternativeBody(MailConfiguration configuration, org.apache.camel.Exchange exchange) -
getGenerateMissingAttachmentNames
-
setGenerateMissingAttachmentNames
-
getHandleDuplicateAttachmentNames
-
setHandleDuplicateAttachmentNames
-