[ 
https://issues.apache.org/jira/browse/MAILET-31?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12984153#action_12984153
 ] 

Norman Maurer commented on MAILET-31:
-------------------------------------

I think I would add setSender(...) to the Mail interface. As a Mail can have a 
"null" sender and I don't like to much the need of use null as argument too ;)

So I would go with:

MailetContext.createMail();
MailetContext.duplicateMail(Mail source);

Or the other option would be 

Mail.newInstance();
Mail.duplicate(Mail mail);

> Mail cloning/creation should be available through MailetContext
> ---------------------------------------------------------------
>
>                 Key: MAILET-31
>                 URL: https://issues.apache.org/jira/browse/MAILET-31
>             Project: Mailet
>          Issue Type: Improvement
>          Components: Core API
>    Affects Versions: 2.4
>            Reporter: Stefano Bagnara
>             Fix For: 2.5
>
>
> we have a bunch of mailets that are not generic because the duplicate the 
> current "Mail". mailet api doesn't provide a way to do this, so our mailets 
> simply have to use "new MailImpl(mail)".
> What about exposing message creation and message duplication methods from the 
> mailet context?  e.g:
>   Mail createMail(String sender);
>   Mail duplicateMail(String sender, Mail original);
>  (as an alternative to have sender as a parameter we could add the
> setSender to the Mail interface. Not sure what's best)
> We could even use a single createMail(sender, original) with nullable 
> original but I don't like too much "nullable" parameters.
> This way a mailet can create a new mail and enqueue it just using 
> MailetContext.
> Not sure if we better should provide create + send (enqueue) methods or if we 
> should instead provide something more "strict" in the api to allow a mailet 
> to split a Mail returning multiple mails.
> As always we should start listing our current use cases.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to