Stefano,
I think this may be a bug, I suspect that if anything else changed the
recipients between "store" and the actual write, that data would be
lost.
Given that mailets are multi threaded I suspect that this could
happen, resulting in mail being "lost" by some recipients and double
copies to others.

Hmm, I'll see if I can *make* it happen.

d.


On 5/31/05, Stefano Bagnara <[EMAIL PROTECTED]> wrote:
> I see that RemoteDelivery does this:
>
> String name = mail.getName();
> for (Iterator i = targets.keySet().iterator(); i.hasNext(); ) {
>     String host = (String) i.next();
>     Collection rec = (Collection) targets.get(host);
>     if (isDebug) {
>         StringBuffer logMessageBuffer =
>             new StringBuffer(128)
>                     .append("Sending mail to ")
>                     .append(rec)
>                     .append(" on host ")
>                     .append(host);
>         log(logMessageBuffer.toString());
>     }
>     mail.setRecipients(rec);
>     StringBuffer nameBuffer =
>         new StringBuffer(128)
>                 .append(name)
>                 .append("-to-")
>                 .append(host);
>     mail.setName(nameBuffer.toString());
>     outgoing.store(mail);
> }
>
> Please note that at every iteration the same "mail" instance is changed and
> stored in the repository with a new name.
>
> Is this a supported way to handle Mailets Mail objects? Wouldn't be more
> correct to clone the original mail at each iteration, assigning the new name
> in the duplicate method and setting its recipients before storing it?
>
> Currently it works fine because RemoteDelivery does not support passthrough
> and because we use the setName that is not and should not be available via
> Mail interface.
>
> We should pay attention to this issues when talking about the new mailet
> API.
>
> Stefano
>
>

Reply via email to