Hi everyone,
I've refactored some code contributed by Fabrice and Jérome into a
plugin that I committed to the xwiki-sandbox, under the
plugins/mailsender folder (I'm using the sandbox since I find it handy
for progressive refactoring and integration, but Vincent, please let me
know if I should use JIRA attachments instead!).
The plugin currently has the following API:
===========
int sendTextMessage(String from, String to, String subject, String message)
int sendTextMessage(String from, String to, String cc, String bcc,
String subject,String message, List<Attachment> attachments)
int sendHtmlMessage(String from, String to, String cc, String bcc,
String subject, String body, String alternative, List<Attachment>
attachments)
int sendMessageFromTemplate(String from, String to, String cc, String
bcc, String language, String documentFullName, VelocityContext vcontext)
===========
The plugin creates its own "XWiki.Mail" class that has the following fields:
- subject
- language
- text part
- optional html part
The class XWik.Mail is used by the method "sendMessageFromTemplate":
this method evaluates the fields of the XWiki.Mail objects attached to
the template document for building a custom message by using a
VelocityRenderer.
What do you think of the API? Any refactoring or enhancement remarks?
Can we proceed with test and documentation writing, and submission for
integration into 1.1M4?
Related JIRA thread:
http://jira.xwiki.org/jira/browse/XWIKI-1473
Cheers
Stéphane