Package org.apache.camel.component.mail
Class MailEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.support.ScheduledPollEndpoint
org.apache.camel.component.mail.MailEndpoint
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasId,org.apache.camel.spi.HeaderFilterStrategyAware,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="1.0.0",
scheme="imap,imaps,pop3,pop3s,smtp,smtps",
title="IMAP,IMAPS,POP3,POP3S,SMTP,SMTPS",
syntax="imap:host:port",
alternativeSyntax="imap:username:password@host:port",
category=MAIL,
headersClass=MailConstants.class)
public class MailEndpoint
extends org.apache.camel.support.ScheduledPollEndpoint
implements org.apache.camel.spi.HeaderFilterStrategyAware
Send and receive emails using imap, pop3 and smtp protocols.
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsConstructorDescriptionMailEndpoint(String endpointUri) MailEndpoint(String uri, MailComponent component, MailConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor, JavaMailSender sender) Creates a consumer using the given processor and senderorg.apache.camel.ExchangecreateExchange(jakarta.mail.Message message) org.apache.camel.Producerorg.apache.camel.ProducercreateProducer(JavaMailSender sender) Creates a producer using the given senderorg.apache.camel.spi.HeaderFilterStrategyorg.apache.camel.spi.IdempotentRepositoryintjakarta.mail.search.SearchTermcom.sun.mail.imap.SortTerm[]booleanvoidsetBinding(MailBinding binding) Sets the binding used to convert from a Camel message to and from a Mail messagevoidsetConfiguration(MailConfiguration configuration) Sets the Mail configurationvoidsetContentTypeResolver(ContentTypeResolver contentTypeResolver) Resolver to determine Content-Type for file attachments.voidsetDelay(long delay) Milliseconds before the next poll.voidsetHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) To use a customHeaderFilterStrategyto filter headers.voidsetIdempotentRepository(org.apache.camel.spi.IdempotentRepository idempotentRepository) 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.voidsetIdempotentRepositoryRemoveOnCommit(boolean idempotentRepositoryRemoveOnCommit) 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.voidsetMailUidGenerator(MailUidGenerator mailUidGenerator) A pluggableMailUidGeneratorthat allows to use custom logic to generate UUID of the mail message.voidsetMaxMessagesPerPoll(int maxMessagesPerPoll) Specifies the maximum number of messages to gather per poll.voidsetPostProcessAction(MailBoxPostProcessAction postProcessAction) Refers to anMailBoxPostProcessActionfor doing post processing tasks on the mailbox once the normal processing ended.voidsetSearchTerm(jakarta.mail.search.SearchTerm searchTerm) Refers to aSearchTermwhich allows to filter mails based on search criteria such as subject, body, from, sent after a certain date etc.voidsetSortTerm(com.sun.mail.imap.SortTerm[] sortTerm) Sorting order for messages.Methods inherited from class org.apache.camel.support.ScheduledPollEndpoint
configureConsumer, configureProperties, configureScheduledPollConsumerProperties, doConfigureConsumer, doStart, doStop, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDefaultDelay, getDelay, getInitialDelay, getPollStrategy, getRepeatCount, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setGreedy, setInitialDelay, setPollStrategy, setRepeatCount, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelayMethods inherited from class org.apache.camel.support.DefaultEndpoint
configureExchange, configurePollingConsumer, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toStringMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isSingletonProducerMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
MailEndpoint
public MailEndpoint() -
MailEndpoint
-
MailEndpoint
-
-
Method Details
-
createProducer
- Specified by:
createProducerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createProducer
Creates a producer using the given sender -
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Specified by:
createConsumerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor, JavaMailSender sender) throws Exception Creates a consumer using the given processor and sender- Throws:
Exception
-
createExchange
public org.apache.camel.Exchange createExchange(jakarta.mail.Message message) -
getBinding
-
setBinding
Sets the binding used to convert from a Camel message to and from a Mail message -
getConfiguration
-
setConfiguration
Sets the Mail configuration -
getHeaderFilterStrategy
public org.apache.camel.spi.HeaderFilterStrategy getHeaderFilterStrategy()- Specified by:
getHeaderFilterStrategyin interfaceorg.apache.camel.spi.HeaderFilterStrategyAware
-
setHeaderFilterStrategy
public void setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) To use a customHeaderFilterStrategyto filter headers.- Specified by:
setHeaderFilterStrategyin interfaceorg.apache.camel.spi.HeaderFilterStrategyAware
-
getContentTypeResolver
-
setContentTypeResolver
Resolver to determine Content-Type for file attachments. -
getMaxMessagesPerPoll
public int getMaxMessagesPerPoll() -
setMaxMessagesPerPoll
public void setMaxMessagesPerPoll(int maxMessagesPerPoll) 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. -
getSearchTerm
public jakarta.mail.search.SearchTerm getSearchTerm() -
setSearchTerm
public void setSearchTerm(jakarta.mail.search.SearchTerm searchTerm) Refers to aSearchTermwhich allows to filter mails based on search criteria such as subject, body, from, sent after a certain date etc. -
getSortTerm
public com.sun.mail.imap.SortTerm[] getSortTerm() -
setSortTerm
public void setSortTerm(com.sun.mail.imap.SortTerm[] sortTerm) 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. -
getPostProcessAction
-
setPostProcessAction
Refers to anMailBoxPostProcessActionfor doing post processing tasks on the mailbox once the normal processing ended. -
getIdempotentRepository
public org.apache.camel.spi.IdempotentRepository getIdempotentRepository() -
setIdempotentRepository
public void setIdempotentRepository(org.apache.camel.spi.IdempotentRepository idempotentRepository) 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. -
isIdempotentRepositoryRemoveOnCommit
public boolean isIdempotentRepositoryRemoveOnCommit() -
setIdempotentRepositoryRemoveOnCommit
public void setIdempotentRepositoryRemoveOnCommit(boolean idempotentRepositoryRemoveOnCommit) 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. -
getMailUidGenerator
-
setMailUidGenerator
A pluggableMailUidGeneratorthat allows to use custom logic to generate UUID of the mail message. -
setDelay
public void setDelay(long delay) Milliseconds before the next poll.- Overrides:
setDelayin classorg.apache.camel.support.ScheduledPollEndpoint
-