I have below code for sending the mail as soon as message code to queue a mail should be fired
Code:
 

<context:component-scan base-package="com.walgreens.ods.producer" />
	<int:channel id="receive-jms-message-channel">
		<int:queue capacity="10" />
	</int:channel>
		
	<int:channel id="input"></int:channel>
	<jms:outbound-channel-adapter channel="input" destination-name="errorQueue"></jms:outbound-channel-adapter>
		
<jms:message-driven-channel-adapter
		id="mq-message-listner" channel="receive-jms-message-channel"
		destination-name="errorQueue" concurrent-consumers="10" />	
	
	

<mail:outbound-channel-adapter channel="receive-jms-message-channel"
mail-sender="mailSender"/>
<mail:header-enricher input-channel="receive-jms-message-channel" output-channel="outboundMail">
<mail:to value="saxenasaral@gmail.com"/>
<mail:from value="rahulsxn660@gmail.com"/>
<mail:subject value="Test"/>
</mail:header-enricher>

<int:channel id="outboundMail"></int:channel>
I got the below error

ERROR org.springframework.integration.handler.LoggingHan dler handleMessageInternal org.springframework.integration.MessageHandlingExc eption: error occurred in message handler [org.springframework.integration.mail.MailSendingMe ssageHandler#0]
at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:84)
at org.springframework.integration.endpoint.PollingCo nsumer.doPoll(PollingConsumer.java:70)
at org.springframework.integration.endpoint.AbstractP ollingEndpoint$1.call(AbstractPollingEndpoint.java :146)
at org.springframework.integration.endpoint.AbstractP ollingEndpoint$1.call(AbstractPollingEndpoint.java :144)
at org.springframework.integration.endpoint.AbstractP ollingEndpoint$Poller$1.run(AbstractPollingEndpoin t.java:207)
at org.springframework.integration.util.ErrorHandling TaskExecutor$1.run(ErrorHandlingTaskExecutor.java: 52)
at org.springframework.core.task.SyncTaskExecutor.exe cute(SyncTaskExecutor.java:48)
at org.springframework.integration.util.ErrorHandling TaskExecutor.execute(ErrorHandlingTaskExecutor.jav a:49)
at org.springframework.integration.endpoint.AbstractP ollingEndpoint$Poller.run(AbstractPollingEndpoint. java:202)
at org.springframework.scheduling.support.DelegatingE rrorHandlingRunnable.run(DelegatingErrorHandlingRu nnable.java:51)
at org.springframework.scheduling.concurrent.Reschedu lingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.cal l(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.jav a:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$S cheduledFutureTask.access$301(ScheduledThreadPoolE xecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$S cheduledFutureTask.run(ScheduledThreadPoolExecutor .java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalStateException: No recipient has been provided on the MailMessage or the 'MailHeaders.TO' header.
at org.springframework.util.Assert.state(Assert.java: 384)
at org.springframework.integration.mail.MailSendingMe ssageHandler.applyHeadersToMailMessage(MailSending MessageHandler.java:158)
at org.springframework.integration.mail.MailSendingMe ssageHandler.convertMessageToMailMessage(MailSendi ngMessageHandler.java:111)
at org.springframework.integration.mail.MailSendingMe ssageHandler.handleMessageInternal(MailSendingMess ageHandler.java:71)
at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:78)
... 18 more