[ 
https://issues.apache.org/jira/browse/CAMEL-27895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18153826#comment-18153826
 ] 

Guillaume Nodet commented on CAMEL-27895:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

Root cause confirmed: (1) MailConsumer.retrieveMessages() leaks idempotent keys 
when createExchange() returns null (message flagged DELETED) - 
removeIdempotentKey() is only in the catch block. (2) 
MailConfiguration.setUsername() checks getRecipients().size() == 0 instead of 
checking specifically whether TO is set, so CC/BCC parsed before username 
prevent default To from being applied.

_Note: This comment was generated by an AI coding agent and requires manual 
verification._

> camel-mail: a failed mail is skipped for good with an idempotentRepository, 
> the To default depends on option order
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27895
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27895
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mail
>            Reporter: Claus Ibsen
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-mail for CAMEL-23832 
> (commit 
> https://github.com/apache/camel/commit/75db9fd61fefdeccafd7be357062dd8e7ba31805,
>  pull request https://github.com/apache/camel/pull/31159).
> These are separate problems of the component; the descriptions change only 
> documents the current behavior.
> h4. 1. A failed mail is skipped for good with an idempotentRepository
> {{MailConsumer.retrieveMessages}} adds the idempotent key in isValidMessage 
> before createExchange; when createExchange returns null (a mail flagged 
> DELETED, or one that failed with skipFailedMessage or handleFailedMessage), 
> the key is never removed, so every consumer sharing the repository skips the 
> mail for good.
> Proposed change: call removeIdempotentKey when createExchange returns null.
> h4. 2. The To default depends on the order of the options
> {{MailConfiguration.setUsername}} sets To to username(@host) only when no 
> recipient is set yet, so ?cc=a@x&username=u sends without a To, and 
> ?username=u&cc=a@x sends To u@host plus Cc a@x.
> Proposed change: apply the default after all options are set, when to, cc and 
> bcc are empty.
> h4. 3. debugMode sets javax.net.debug as a session property
> createJavaMailProperties puts javax.net.debug=all into the Session 
> properties, where JSSE never reads it (it is a JVM system property).
> Proposed change: remove it, or document -Djavax.net.debug.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to