Re: How to send a templated mail with attachment?
Which Camel version do you use? How the stack trace looks like? Do you consider to provide a unit test to show the issue? Than it's easier for us to find/fix the issue. Best, Christian Am 11.01.2013 09:40 schrieb Arjen Duursma duur...@zorgdomein.nl: The same (missing attachments) seems to be happening to other components as well. I have a route retrieving reports on failed mail attempts (multipart/report) from a pop3 component. Using a xslt transform for generating the actual body before remailing it. After 'saving' the relevant information as an attachement (tested and works) I try to enrich the message based on some identifier from the subject of the original mail. I do this by including: route from direct:extra-info / setBodyxquery ... /setBody to uri:jdbc:... / marshalxstream encoding=UTF-8 //marshal /route After this route, the attachements are gone :-( I modified the route to call this route using the 'enrich' pattern using a generic ReplaceBodyAggregation. This fails due to a NullPointerException in the XmlConverter during the xslt rendering of the replaced body. The system doesn't seem to be able to find typeconverters in the CamelContext. If I make the ReplaceBodyAggregation less generic by specifying the expected body class as Document.class, it suddenly works. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5725353.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to send a templated mail with attachment?
The same (missing attachments) seems to be happening to other components as well. I have a route retrieving reports on failed mail attempts (multipart/report) from a pop3 component. Using a xslt transform for generating the actual body before remailing it. After 'saving' the relevant information as an attachement (tested and works) I try to enrich the message based on some identifier from the subject of the original mail. I do this by including: route from direct:extra-info / setBodyxquery ... /setBody to uri:jdbc:... / marshalxstream encoding=UTF-8 //marshal /route After this route, the attachements are gone :-( I modified the route to call this route using the 'enrich' pattern using a generic ReplaceBodyAggregation. This fails due to a NullPointerException in the XmlConverter during the xslt rendering of the replaced body. The system doesn't seem to be able to find typeconverters in the CamelContext. If I make the ReplaceBodyAggregation less generic by specifying the expected body class as Document.class, it suddenly works. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5725353.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to send a templated mail with attachment?
Thanks for fixing, I didn't try it out because I think I cannot use a snapshot version. But I used enrich as you proposed so now I can send emails with an attachment :). Is there a reason to use a direct endpoint in between, instead of using the stringtemplate endpoint directly in the enrich method? Christian Mueller wrote I had to fix camel-stringtemplate, camel-freemaker and camel-velocity in all supported branches (trunk, camel-2.9.x, camel-2.8.x and camel-2.7.x). If you cannot use a snapshot version (what I asume), I would propose to use the enricher component as a workaround. Something like: from(xxx) .enrich(direct:workaround, aggregationStrategie) .to(smtp:XXX); from(direct:workaround) .to(stringtemplate:XXX); And the aggregation strategie can copy the attachment from the old exchange to the new one. Sorry for this inconvenience. Let me know if you need help here. Best, Christian -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5133615.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to send a templated mail with attachment?
Actually you can use stringtemplate or any other uri in enrich. But using direct helps to split the process in separate logical steps. You can have direct:generateEmailBody and if you need to do anything else for the step you can simply update the route. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5133857.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to send a templated mail with attachment?
Exactly. I copy pasted the sniped from one of our routes which are more complex. But as already mentioned, if you don't need any complex pre processing, your valid route could also looks as below: from(xxx) .enrich(stringtemplate:XXX, aggregationStrategie) .to(smtp:XXX); Best, Christian On Tue, Jan 10, 2012 at 11:55 AM, v_peter v_pe...@ukr.net wrote: Actually you can use stringtemplate or any other uri in enrich. But using direct helps to split the process in separate logical steps. You can have direct:generateEmailBody and if you need to do anything else for the step you can simply update the route. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5133857.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to send a templated mail with attachment?
Hi, Do you have any information about plans of 2.9.1 and/or 2.10.0 releases? Regards, Peter Velychko -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5131386.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to send a templated mail with attachment?
We just released Camel 2.9.0 2 weeks ago. We try to build a new minor version (2.10.0) after round about 3 month. You will see Camel 2.9.1 earlier, but it will also takes some more weeks. Best, Christian On Mon, Jan 9, 2012 at 2:58 PM, v_peter v_pe...@ukr.net wrote: Hi, Do you have any information about plans of 2.9.1 and/or 2.10.0 releases? Regards, Peter Velychko -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5131386.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to send a templated mail with attachment?
I had to fix camel-stringtemplate, camel-freemaker and camel-velocity in all supported branches (trunk, camel-2.9.x, camel-2.8.x and camel-2.7.x). If you cannot use a snapshot version (what I asume), I would propose to use the enricher component as a workaround. Something like: from(xxx) .enrich(direct:workaround, aggregationStrategie) .to(smtp:XXX); from(direct:workaround) .to(stringtemplate:XXX); And the aggregation strategie can copy the attachment from the old exchange to the new one. Sorry for this inconvenience. Let me know if you need help here. Best, Christian
How to send a templated mail with attachment?
In my camel route I download and unpack zip files. When something goes wrong, I want to send a mail with the zip file that has gone wrong as an attachment. I want to construct the body of this mail using a template. When I first add the zip file as an attachment to the message and next route it to a template, the attachment is lost. When I first route the message to the template, I lose the zipfile as message body and can't add it as attachment. Is it possible to use a template with an attachment? -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5125167.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to send a templated mail with attachment?
Hi What version of Camel are you using? And which template components are you using? Maybe post a snippet of your route. On Fri, Jan 6, 2012 at 11:32 AM, LNB lnijbijv...@kluwer.nl wrote: In my camel route I download and unpack zip files. When something goes wrong, I want to send a mail with the zip file that has gone wrong as an attachment. I want to construct the body of this mail using a template. When I first add the zip file as an attachment to the message and next route it to a template, the attachment is lost. When I first route the message to the template, I lose the zipfile as message body and can't add it as attachment. Is it possible to use a template with an attachment? -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5125167.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: How to send a templated mail with attachment?
I'm using camel 2.7.3 and a stringtemplate, but I could use an other template if that would be useful. My code looks like: onException(ZipFormatException.class).handled(true) .to(file: + errorDir.toString()) //move corrupted zip to another directory .process(mailBuilder) .to(string-template:corruptedzipMail.tm)//doesn't work, attachment lost .to(smtp:+ mailEndpoint); Processor mailBuilder = new Processor() { @Override public void process(Exchange exchange) throws Exception { File file = ExchangeHelper.getMandatoryInBody(exchange, File.class); exchange.getIn().setHeader(subject, Builder.constant(CAMEL TEST mail)); exchange.getIn().addAttachment(file.getName(), new DataHandler(new FileDataSource(file))); } }; Claus Ibsen-2 wrote Hi What version of Camel are you using? And which template components are you using? Maybe post a snippet of your route. On Fri, Jan 6, 2012 at 11:32 AM, LNB lt;lnijbijvank@gt; wrote: In my camel route I download and unpack zip files. When something goes wrong, I want to send a mail with the zip file that has gone wrong as an attachment. I want to construct the body of this mail using a template. When I first add the zip file as an attachment to the message and next route it to a template, the attachment is lost. When I first route the message to the template, I lose the zipfile as message body and can't add it as attachment. Is it possible to use a template with an attachment? -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5125167.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - FuseSource Email: cibsen@ Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/ -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5125742.html Sent from the Camel - Users mailing list archive at Nabble.com.