You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cbuxbaum <cb...@tradestonesoftware.com> on 2012/04/19 20:10:59 UTC

scratching my head over camel mail component

Hi,

I am doing a straightforward call to the Camel mail component:

			Exchange exc = endpoint.createExchange();
			Message in = exc.getIn();
			in.setBody(failureEmailBody);
			Map headers = in.getHeaders();
			if (headers == null)
			{
				headers = new HashMap();
			}
			headers.put("From", this.fromEmailAddress);
			headers.put("To", this.emailAddresses);
			headers.put("Subject", "TECH PACK EXPORT SYSTEM ERROR");
			headers.put("contentType", "text/html");
			in.setHeaders(headers);
			if (log.isDebugEnabled())
			{
				for (Iterator it = headers.keySet().iterator(); it.hasNext();) 
				{
		           String key = (String) it.next();
		           log.debug("Key:" + key + ", Value:" + headers.get(key));
		        }
			}
			// create a producer that can produce the exchange (= send the mail)
			Producer producer = endpoint.createProducer();
			// start the producer
			producer.start();
			// and let it go (processes the exchange by sending the email)
			producer.process(exc);

In my logging, I see the to and from addresses being set, but I get this in
the logs:

DEBUG USER_ID -  2012-04-19 13:30:03,260 [Camel (camel-1) thread #2 -
ai=processor-thread] - Creating endpoint
uri=[smtp://iexsmtp01.ius.meijer.com:25],
path=[iexsmtp01.ius.meijer.com:25], parameters=[{}]
DEBUG USER_ID -  2012-04-19 13:30:03,260 [Camel (camel-1) thread #2 -
ai=processor-thread] - smtp://iexsmtp01.ius.meijer.com:25 converted to
endpoint: Endpoint[smtp://iexsmtp01.ius.meijer.com:25] by component:
org.apache.camel.component.mail.MailComponent@ee9867d
DEBUG USER_ID -  2012-04-19 13:30:03,260 [Camel (camel-1) thread #2 -
ai=processor-thread] - Key:to, Value:9990659@ius.meijer.com
DEBUG USER_ID -  2012-04-19 13:30:03,260 [Camel (camel-1) thread #2 -
ai=processor-thread] - Key:subject, Value:TECH PACK EXPORT SYSTEM ERROR
DEBUG USER_ID -  2012-04-19 13:30:03,260 [Camel (camel-1) thread #2 -
ai=processor-thread] - Key:from, Value:9990659@ius.meijer.com
DEBUG USER_ID -  2012-04-19 13:30:03,260 [Camel (camel-1) thread #2 -
ai=processor-thread] - Key:contenttype, Value:text/html
DEBUG USER_ID -  2012-04-19 13:30:03,291 [Camel (camel-1) thread #2 -
ai=processor-thread] - Starting producer:
Producer[smtp://iexsmtp01.ius.meijer.com:25]
DEBUG USER_ID -  2012-04-19 13:30:03,291 [Camel (camel-1) thread #2 -
ai=processor-thread] - Failed delivery for exchangeId:
ID-w0982iappv0237-54723-1334856005201-0-3. On delivery attempt: 0 caught:
java.lang.IllegalArgumentException: The mail message does not have any
recipients set.
ERROR USER_ID -  2012-04-19 13:30:03,291 [Camel (camel-1) thread #2 -
ai=processor-thread] - Failed delivery for exchangeId:
ID-w0982iappv0237-54723-1334856005201-0-3. Exhausted after delivery attempt:
1 caught: java.lang.IllegalArgumentException: The mail message does not have
any recipients set.
java.lang.IllegalArgumentException: The mail message does not have any
recipients set.

Where is the header or the "to value" getting lost?  This works fine in my
own environment, but on a customer dev env they get this issue.  This is
running as a war under tomcat

Thanks,

Carl

--
View this message in context: http://camel.465427.n5.nabble.com/scratching-my-head-over-camel-mail-component-tp5652412p5652412.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: scratching my head over camel mail component

Posted by cbuxbaum <cb...@tradestonesoftware.com>.
I believe I know the solution, if not the cause.  Our customer is using an
much older version of JavaMail.  Must be that MimeMessage.addRecipients is
not behaving properly.

--
View this message in context: http://camel.465427.n5.nabble.com/scratching-my-head-over-camel-mail-component-tp5652412p5652711.html
Sent from the Camel - Users mailing list archive at Nabble.com.