2 Home
gitea_admin edited this page 2026-03-11 14:41:50 +00:00

POP3

Send and receive emails using imap, pop3 and smtp protocols.

Metadata

Property Value
Scheme pop3
Support Level Stable
Labels mail
Version 4.10.2

Maven Dependency

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-mail</artifactId>
    <version>4.10.2</version>
</dependency>

Endpoint Properties

Name Type Required Default Description
host string The mail server host name
port integer The port number of the mail server
closeFolder boolean true Whether the consumer should close the folder after polling. Setting this option to false and having disconnect=false as well, then the consumer keeps the folder open between polls.
copyTo string After processing a mail message, it can be copied to a mail folder with the given name. You can override this configuration value with a header with the key copyTo, allowing you to copy messages to folder names configured at runtime.
decodeFilename boolean false If set to true, the MimeUtility.decodeText method will be used to decode the filename. This is similar to setting JVM system property mail.mime.encodefilename.
delete boolean false Deletes the messages after they have been processed. This is done by setting the DELETED flag on the mail message. If false, the SEEN flag is set instead. You can override this configuration option by setting a header with the key delete to determine if the mail should be deleted or not.
disconnect boolean false Whether the consumer should disconnect after polling. If enabled, this forces Camel to connect on each poll.
handleFailedMessage boolean false If the mail consumer cannot retrieve a given mail message, then this option allows handling the caused exception by the consumer's error handler. By enabling the bridge error handler on the consumer, then the Camel routing error handler can handle the exception instead. The default behavior would be the consumer throws an exception and no mails from the batch would be able to be routed by Camel.
maxMessagesPerPoll integer Specifies the maximum number of messages to gather per poll. By default, no maximum is set. Can be used to set a limit of e.g. 1000 to avoid downloading thousands of files when the server starts up. Set a value of 0 or negative to disable this option.
mimeDecodeHeaders boolean false This option enables transparent MIME decoding and unfolding for mail headers.
moveTo string After processing a mail message, it can be moved to a mail folder with the given name. You can override this configuration value with a header with the key moveTo, allowing you to move messages to folder names configured at runtime.
peek boolean true Will mark the jakarta.mail.Message as peeked before processing the mail message. This applies to IMAPMessage messages types only. By using peek, the mail will not be eagerly marked as SEEN on the mail server, which allows us to roll back the mail message if there is a processing error in Camel.
sendEmptyMessageWhenIdle boolean false If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead.
skipFailedMessage boolean false If the mail consumer cannot retrieve a given mail message, then this option allows skipping the message and move on to retrieve the next mail message. The default behavior would be the consumer throws an exception and no mails from the batch would be able to be routed by Camel.
unseen boolean true Whether to limit by unseen mails only.
bridgeErrorHandler boolean false Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.
exceptionHandler object To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored.
exchangePattern object Sets the exchange pattern when the consumer creates an exchange.
failOnDuplicateFileAttachment boolean false Whether to fail processing the mail if the mail message contains attachments with duplicate file names. If set to false, then the duplicate attachment is skipped and a WARN is logged. If set to true, then an exception is thrown failing to process the mail message.
fetchSize integer -1 Sets the maximum number of messages to consume during a poll. This can be used to avoid overloading a mail server, if a mailbox folder contains a lot of messages. The default value of -1 means no fetch size and all messages will be consumed. Setting the value to 0 is a special corner case, where Camel will not consume any messages at all.
folderName string INBOX The folder to poll.
generateMissingAttachmentNames string Set this to 'uuid' to set a UUID for the filename of the attachment if no filename was set
handleDuplicateAttachmentNames string Set the strategy to handle duplicate filenames of attachments never: attachments that have a filename which is already present in the attachments will be ignored unless failOnDuplicateFileAttachment is set to true. uuidPrefix: this will prefix the duplicate attachment filenames each with an uuid and underscore (uuid_filename.fileextension). uuidSuffix: this will suffix the duplicate attachment filenames each with an underscore and uuid (filename_uuid.fileextension).
mailUidGenerator object A pluggable MailUidGenerator that allows to use custom logic to generate UUID of the mail message.
mapMailMessage boolean true Specifies whether Camel should map the received mail message to Camel body/headers/attachments. If set to true, the body of the mail message is mapped to the body of the Camel IN message, the mail headers are mapped to IN headers, and the attachments to Camel IN attachment message. If this option is set to false, then the IN message contains a raw jakarta.mail.Message. You can retrieve this raw message by calling exchange.getIn().getBody(jakarta.mail.Message.class).
pollStrategy object A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel.
postProcessAction object Refers to an MailBoxPostProcessAction for doing post processing tasks on the mailbox once the normal processing ended.
bcc string Sets the BCC email address. Separate multiple email addresses with comma.
cc string Sets the CC email address. Separate multiple email addresses with comma.
from string camel@localhost The from email address
replyTo string The Reply-To recipients (the receivers of the response mail). Separate multiple email addresses with a comma.
subject string The Subject of the message being sent. Note: Setting the subject in the header takes precedence over this option.
to string Sets the destination email address. Separate multiple email addresses with comma.
javaMailSender object To use a custom org.apache.camel.component.mail.JavaMailSender for sending emails.
lazyStartProducer boolean false Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.
additionalJavaMailProperties object Sets additional java mail properties, that will append/override any default properties that are set based on all the other options. This is useful if you need to add some special options but want to keep the others as is.
alternativeBodyHeader string CamelMailAlternativeBody Specifies the key to an IN message header that contains an alternative email body. For example, if you send emails in text/html format and want to provide an alternative mail body for non-HTML email clients, set the alternative mail body with this key as a header.
attachmentsContentTransferEncodingResolver object To use a custom AttachmentsContentTransferEncodingResolver to resolve what content-type-encoding to use for attachments.
authenticator object The authenticator for login. If set then the password and username are ignored. It can be used for tokens which can expire and therefore must be read dynamically.
binding object Sets the binding used to convert from a Camel message to and from a Mail message
connectionTimeout integer 30000 The connection timeout in milliseconds.
contentType string text/plain The mail message content type. Use text/html for HTML mails.
contentTypeResolver object Resolver to determine Content-Type for file attachments.
debugMode boolean false Enable debug mode on the underlying mail framework. The SUN Mail framework logs the debug messages to System.out by default.
headerFilterStrategy object To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter headers.
ignoreUnsupportedCharset boolean false Option to let Camel ignore unsupported charset in the local JVM when sending mails. If the charset is unsupported, then charset=XXX (where XXX represents the unsupported charset) is removed from the content-type, and it relies on the platform default instead.
ignoreUriScheme boolean false Option to let Camel ignore unsupported charset in the local JVM when sending mails. If the charset is unsupported, then charset=XXX (where XXX represents the unsupported charset) is removed from the content-type, and it relies on the platform default instead.
javaMailProperties object Sets the java mail options. Will clear any default properties and only use the properties provided for this method.
session object Specifies the mail session that camel should use for all mail interactions. Useful in scenarios where mail sessions are created and managed by some other resource, such as a JavaEE container. When using a custom mail session, then the hostname and port from the mail session will be used (if configured on the session).
useInlineAttachments boolean false Whether to use disposition inline or attachment.
idempotentRepository object A pluggable repository org.apache.camel.spi.IdempotentRepository which allows to cluster consuming from the same mailbox, and let the repository coordinate whether a mail message is valid for the consumer to process. By default no repository is in use.
idempotentRepositoryRemoveOnCommit boolean true When using idempotent repository, then when the mail message has been successfully processed and is committed, should the message id be removed from the idempotent repository (default) or be kept in the repository. By default its assumed the message id is unique and has no value to be kept in the repository, because the mail message will be marked as seen/moved or deleted to prevent it from being consumed again. And therefore having the message id stored in the idempotent repository has little value. However this option allows to store the message id, for whatever reason you may have.
searchTerm object Refers to a jakarta.mail.search.SearchTerm which allows to filter mails based on search criteria such as subject, body, from, sent after a certain date etc.
backoffErrorThreshold integer The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in.
backoffIdleThreshold integer The number of subsequent idle polls that should happen before the backoffMultipler should kick-in.
backoffMultiplier integer To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured.
delay duration 60000 Milliseconds before the next poll.
greedy boolean false If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages.
initialDelay integer 1000 Milliseconds before the first poll starts.
repeatCount integer 0 Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever.
runLoggingLevel object TRACE The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that.
scheduledExecutorService object Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool.
scheduler object none To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler
schedulerProperties object To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler.
startScheduler boolean true Whether the scheduler should be auto started.
timeUnit object MILLISECONDS Time unit for initialDelay and delay options.
useFixedDelay boolean true Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.
password string The password for login. See also setAuthenticator(MailAuthenticator).
sslContextParameters object To configure security using SSLContextParameters.
username string The username for login. See also setAuthenticator(MailAuthenticator).
sortTerm object Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability.