You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ven12344 <ve...@yahoo.com> on 2012/03/06 20:31:25 UTC
Need help in Camel to send emails
Hi, I have a requirement where I am sending an email when there is a error in
our billing system.
I have the route like this.
<route>
<from
uri="smtp://${col_username}@${col_host}.com:${port}?password=${col_password}&filter=#errorBillingResponseEmailing"/>
<to
uri="smtp://${col_username}@${col_host}.com:${port}?password=${col_password}&amp;<b>subject*=${subject}&*contentType*=text/plain&folderName=INBOX&filter=#errorBillingResponseEmailing"/>
</route>
I want to set a body of the email and also when the email is sent, the email
must move to sent folder when it is successfully sent.
I have a "subject" attribute, not sure if I can provide the body for that.
Please let me know.
Thanks
--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-in-Camel-to-send-emails-tp5541960p5541960.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Need help in Camel to send emails
Posted by ven12344 <ve...@yahoo.com>.
Hi Yogesh, can you tell me the example for the smtp uri.
Is there any way that we can specify the body of the email in the smtp "to"
uri.
I want to keep this as a simple emailing application. We have decided not to
write beans for emailing rather do it in the spring format, it is said my
our team here. So I should go with that.
This works fine, but I need to know just the "body" part of the email in
this route for spring xml file
<route>
<from
uri="smtp://${col_username}@${col_host}.com:${port}?password=${col_password}&filter=#errorBillingResponseEmailing"/>
<to
uri="smtp://${col_username}@${col_host}.com:${port}?password=${col_password}&amp;<b>subject=${subject}&contentType=text/plain&folderName=INBOX&filter=#errorBillingResponseEmailing"/>
</route>
Because we are writing a bean for the error billing response that we are
calling in this route for email, so we need to make this email stuff in the
spring xml only.
Thanks.
--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-in-Camel-to-send-emails-tp5541960p5547703.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Need help in Camel to send emails
Posted by ychawla <pr...@yahoo.com>.
Hi,
Are you trying to set the 'to' field in your email. You can either set that
on the smtp URI or in a header. For example:
<setHeader
headerName="to"><constant>recipient@domain.com</constant></setHeader>
The body of your email is whatever is on your message body.
If you want to set it as part of your route, try using a bean:
<to uri="bean:createEmailBodyBean?method=createEmailBody"/>
public String createEmailBody()
{
return "Some email body string here";
}
Thanks,
Yogesh
--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-in-Camel-to-send-emails-tp5541960p5542525.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Need help in Camel to send emails
Posted by ychawla <pr...@yahoo.com>.
Hi,
The body of the email will be whatever you have as the current body of the
Camel exchange. You can explicitly set the body as well:
<camel:setBody><constant>This is my email body</constant></camel:setBody>
To control when the email is sent, you can split up your route:
<route>
<from
uri="smtp://${col_username}@${col_host}.com:${port}?password=${col_password}&filter=#errorBillingResponseEmailing"/>
<to uri="file:someFolder"/>
</route>
Then you can use quartz to set up a timer to poll your folder:
http://camel.465427.n5.nabble.com/Consuming-Files-using-Timer-Quartz-td3320330.html
If you don't have complex requirements for when it is sent, the file URI
syntax could be sufficient.
You can tell Camel to delete all emails it consumes by configuration. Once
you do this, you can BCC your mailbox and apply an email rule to put a copy
of the email sent in the 'sent' folder.
Cheers,
Yogesh
--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-in-Camel-to-send-emails-tp5541960p5542072.html
Sent from the Camel - Users mailing list archive at Nabble.com.