You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ychawla <pr...@gmail.com> on 2014/10/23 16:40:30 UTC
Camel Mail CC and BCC headers
Hello All,
I recently had a production issue where there was an exception thrown when
the CC or the BCC headers were set to "":
com.sun.mail.smtp.SMTPAddressFailedException: 554 5.1.1 Invalid recipient
address
Is this the expected behavior in Camel or would it be possible for camel to
check for a blank string and not attempt to set these headers when sending
the email.
Thanks,
Yogesh
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Mail-CC-and-BCC-headers-tp5757943.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Mail CC and BCC headers
Posted by ychawla <pr...@gmail.com>.
Thanks Willem,
Looks great.
-Yogesh
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Mail-CC-and-BCC-headers-tp5757943p5758097.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Mail CC and BCC headers
Posted by Willem Jiang <wi...@gmail.com>.
Hi,
I just create a JIRA[1] and submitted a quick fix for it.
Please feel free to verify it by using latest Camel 2.15-SNAPSHOT.
[1]https://issues.apache.org/jira/browse/CAMEL-7966
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On October 23, 2014 at 11:21:50 PM, ychawla (premiergeneration@gmail.com) wrote:
> Hello All,
> The MailBinding class contains this method
> setRecipientFromEndpointConfiguration. Perhaps it is just as easy as
> checking the recipients map to see if the CC or BCC are blank or empty
> string prior to setting them in the method. If so, I wouldn't mind
> submitting a patch for this.
>
> Thanks,
> Yogesh
>
> /**
> * Appends the Mail headers from the endpoint configuration.
> */
> protected void setRecipientFromEndpointConfiguration(MimeMessage
> mimeMessage, MailEndpoint endpoint, Exchange exchange)
> throws MessagingException, IOException {
>
> Map recipients =
> endpoint.getConfiguration().getRecipients();
> if (recipients.containsKey(Message.RecipientType.TO)) {
> appendRecipientToMimeMessage(mimeMessage,
> endpoint.getConfiguration(), exchange, Message.RecipientType.TO.toString(),
> recipients.get(Message.RecipientType.TO));
> }
> if (recipients.containsKey(Message.RecipientType.CC)) {
> appendRecipientToMimeMessage(mimeMessage,
> endpoint.getConfiguration(), exchange, Message.RecipientType.CC.toString(),
> recipients.get(Message.RecipientType.CC));
> }
> if (recipients.containsKey(Message.RecipientType.BCC)) {
> appendRecipientToMimeMessage(mimeMessage,
> endpoint.getConfiguration(), exchange, Message.RecipientType.BCC.toString(),
> recipients.get(Message.RecipientType.BCC));
> }
> }
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Mail-CC-and-BCC-headers-tp5757943p5757950.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Camel Mail CC and BCC headers
Posted by ychawla <pr...@gmail.com>.
Hello All,
The MailBinding class contains this method
setRecipientFromEndpointConfiguration. Perhaps it is just as easy as
checking the recipients map to see if the CC or BCC are blank or empty
string prior to setting them in the method. If so, I wouldn't mind
submitting a patch for this.
Thanks,
Yogesh
/**
* Appends the Mail headers from the endpoint configuration.
*/
protected void setRecipientFromEndpointConfiguration(MimeMessage
mimeMessage, MailEndpoint endpoint, Exchange exchange)
throws MessagingException, IOException {
Map<Message.RecipientType, String> recipients =
endpoint.getConfiguration().getRecipients();
if (recipients.containsKey(Message.RecipientType.TO)) {
appendRecipientToMimeMessage(mimeMessage,
endpoint.getConfiguration(), exchange, Message.RecipientType.TO.toString(),
recipients.get(Message.RecipientType.TO));
}
if (recipients.containsKey(Message.RecipientType.CC)) {
appendRecipientToMimeMessage(mimeMessage,
endpoint.getConfiguration(), exchange, Message.RecipientType.CC.toString(),
recipients.get(Message.RecipientType.CC));
}
if (recipients.containsKey(Message.RecipientType.BCC)) {
appendRecipientToMimeMessage(mimeMessage,
endpoint.getConfiguration(), exchange, Message.RecipientType.BCC.toString(),
recipients.get(Message.RecipientType.BCC));
}
}
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Mail-CC-and-BCC-headers-tp5757943p5757950.html
Sent from the Camel - Users mailing list archive at Nabble.com.