简体   繁体   English

在Camel中将smtp与receiveerList一起使用

[英]Using smtp with recipientList in Camel

I am trying to use SMTP component inside recipientList. 我正在尝试使用收件人列表内的SMTP组件。

.recipientList(simple("smtps://smtp.gmail.com?username=abc@gmail.com&password=RAW(abc)&to=${header.alertTo}&subject=RAW(alert)"));

When the value of ${header.alertTo} is just a single email address, this works. 当$ {header.alertTo}的值只是一个电子邮件地址时,此方法有效。 However, if it is comma separated list of address it throws exception. 但是,如果它是用逗号分隔的地址列表,则会引发异常。

No endpoint could be found for: def@gmail.com&subject=RAW(Alert), please check your classpath contains the needed Camel component jar. and the stracktrace is org.apache.camel.NoSuchEndpointException: No endpoint could be found for: def@gmail.com&subject=RAW(Alert), please check your classpath contains the needed Camel component jar.
    at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:65)
    at org.apache.camel.util.ExchangeHelper.resolveEndpoint(ExchangeHelper.java:85)
    at org.apache.camel.processor.RecipientListProcessor.resolveEndpoint(RecipientListProcessor.java:223)
    at org.apache.camel.processor.RecipientListProcessor.createProcessorExchangePairs(RecipientListProcessor.java:163)
    at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:208)
    at org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:153)
    at org.apache.camel.processor.RecipientList.process(RecipientList.java:112)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)

I was earlier using "to" to send these mails. 我之前使用“收件人”发送这些邮件。 That works fine. 很好 But later due to a change involving configurable email addresses for different routes I have to use recipientList. 但是后来由于涉及涉及不同路由的可配置电子邮件地址的更改,我不得不使用收件人列表。

You can change the delimiter char in the recipient list to something else than comma. 您可以将收件人列表中的定界符char更改为逗号以外的其他字符。

See the documentation for how to do that 请参阅文档以了解操作方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM