|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.xpn.xwiki.plugin.XWikiDefaultPlugin
com.xpn.xwiki.plugin.mailsender.MailSenderPlugin
public class MailSenderPlugin
Plugin that brings powerful mailing capabilities.
MailSender| Field Summary | |
|---|---|
static String |
EMAIL_XWIKI_CLASS_NAME
The name of the Object Type holding mail templates. |
static int |
ERROR
Generic error code for plugin failures. |
static int |
ERROR_TEMPLATE_EMAIL_OBJECT_NOT_FOUND
Error code signaling that the mail template requested for sendMailFromTemplate(String, String, String, String, String, String, VelocityContext, XWikiContext) was
not found. |
static String |
ID
The name of the plugin, used for accessing it from scripting environments. |
protected static String |
URL_SEPARATOR
|
| Constructor Summary | |
|---|---|
MailSenderPlugin(String name,
String className,
com.xpn.xwiki.XWikiContext context)
Default plugin constructor. |
|
| Method Summary | |
|---|---|
javax.mail.internet.MimeBodyPart |
createAttachmentBodyPart(Attachment attachment,
com.xpn.xwiki.XWikiContext context)
Add attachments to a multipart message |
javax.mail.Multipart |
createMimeMultipart(Mail mail,
com.xpn.xwiki.XWikiContext context)
Creates a Multipart MIME Message (multiple content-types within the same message) from an existing mail |
protected String |
evaluate(String property,
org.apache.velocity.context.Context context)
Evaluates a String property containing Velocity |
protected String |
getFileName(String path)
Get a file name from its path |
String |
getName()
|
Api |
getPluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface plugin,
com.xpn.xwiki.XWikiContext context)
|
void |
init(com.xpn.xwiki.XWikiContext context)
|
protected com.xpn.xwiki.objects.classes.BaseClass |
initMailClass(com.xpn.xwiki.XWikiContext context)
Creates the Mail XWiki Class |
static String[] |
parseAddresses(String email)
Split comma separated list of emails |
protected void |
parseRawMessage(String rawMessage,
Mail toMail)
Splits a raw mail into headers and the actual content, filling in a Mail object. |
org.apache.velocity.VelocityContext |
prepareVelocityContext(String fromAddr,
String toAddr,
String ccAddr,
String bccAddr,
org.apache.velocity.VelocityContext vcontext,
com.xpn.xwiki.XWikiContext context)
Prepares a Mail Velocity context |
boolean |
sendMail(Mail mailItem,
MailConfiguration mailConfiguration,
com.xpn.xwiki.XWikiContext context)
Send a single Mail |
boolean |
sendMail(Mail mailItem,
com.xpn.xwiki.XWikiContext context)
Send a single Mail |
int |
sendMailFromTemplate(String templateDocFullName,
String from,
String to,
String cc,
String bcc,
String language,
org.apache.velocity.VelocityContext vcontext,
com.xpn.xwiki.XWikiContext context)
Uses an XWiki document to build the message subject and context, based on variables stored in the VelocityContext. |
boolean |
sendMails(Collection<Mail> emails,
MailConfiguration mailConfiguration,
com.xpn.xwiki.XWikiContext context)
Send a Collection of Mails (multiple emails) |
boolean |
sendMails(Collection<Mail> emails,
com.xpn.xwiki.XWikiContext context)
Send a Collection of Mails (multiple emails) |
void |
virtualInit(com.xpn.xwiki.XWikiContext context)
|
| Methods inherited from class com.xpn.xwiki.plugin.XWikiDefaultPlugin |
|---|
beginParsing, beginRendering, commonTagsHandler, downloadAttachment, endParsing, endRendering, endRenderingHandler, flushCache, flushCache, getClassName, insidePREHandler, outsidePREHandler, setClassName, setName, startRenderingHandler |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int ERROR_TEMPLATE_EMAIL_OBJECT_NOT_FOUND
sendMailFromTemplate(String, String, String, String, String, String, VelocityContext, XWikiContext) was
not found.
public static int ERROR
public static final String EMAIL_XWIKI_CLASS_NAME
public static final String ID
protected static final String URL_SEPARATOR
| Constructor Detail |
|---|
public MailSenderPlugin(String name,
String className,
com.xpn.xwiki.XWikiContext context)
XWikiDefaultPlugin.XWikiDefaultPlugin(String,String,com.xpn.xwiki.XWikiContext)| Method Detail |
|---|
public void init(com.xpn.xwiki.XWikiContext context)
init in interface com.xpn.xwiki.plugin.XWikiPluginInterfaceinit in class com.xpn.xwiki.plugin.XWikiDefaultPluginXWikiDefaultPlugin.init(XWikiContext)public void virtualInit(com.xpn.xwiki.XWikiContext context)
virtualInit in interface com.xpn.xwiki.plugin.XWikiPluginInterfacevirtualInit in class com.xpn.xwiki.plugin.XWikiDefaultPluginXWikiDefaultPlugin.virtualInit(XWikiContext)public String getName()
getName in interface com.xpn.xwiki.plugin.XWikiPluginInterfacegetName in class com.xpn.xwiki.plugin.XWikiDefaultPluginXWikiPluginInterface.getName()
public Api getPluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface plugin,
com.xpn.xwiki.XWikiContext context)
getPluginApi in interface com.xpn.xwiki.plugin.XWikiPluginInterfacegetPluginApi in class com.xpn.xwiki.plugin.XWikiDefaultPluginXWikiDefaultPlugin.getPluginApi(XWikiPluginInterface, XWikiContext)public static String[] parseAddresses(String email)
email - comma separated list of emails
protected com.xpn.xwiki.objects.classes.BaseClass initMailClass(com.xpn.xwiki.XWikiContext context)
throws com.xpn.xwiki.XWikiException
context - Context of the request
com.xpn.xwiki.XWikiException
public javax.mail.internet.MimeBodyPart createAttachmentBodyPart(Attachment attachment,
com.xpn.xwiki.XWikiContext context)
throws com.xpn.xwiki.XWikiException,
IOException,
javax.mail.MessagingException
multipart - Multipart messageattachments - List of attachments
com.xpn.xwiki.XWikiException
IOException
javax.mail.MessagingException
public javax.mail.Multipart createMimeMultipart(Mail mail,
com.xpn.xwiki.XWikiContext context)
throws javax.mail.MessagingException,
com.xpn.xwiki.XWikiException,
IOException
mail - The original Mail
javax.mail.MessagingException
com.xpn.xwiki.XWikiException
IOException
protected void parseRawMessage(String rawMessage,
Mail toMail)
Mail object. This method should be
compliant with RFC 2822 as much as possible. If the message accidentally starts with what looks like a mail
header, then that line WILL be considered a header; no check on the semantics of the header is
performed.
rawMessage - the raw content of the message that should be parsedtoMail - the Mail to create
IllegalArgumentException - if the target Mail or the content to parse are null or the empty string
protected String evaluate(String property,
org.apache.velocity.context.Context context)
throws Exception
property - The String propertycontext - Context of the request
Exceptionprotected String getFileName(String path)
path - The file path
public org.apache.velocity.VelocityContext prepareVelocityContext(String fromAddr,
String toAddr,
String ccAddr,
String bccAddr,
org.apache.velocity.VelocityContext vcontext,
com.xpn.xwiki.XWikiContext context)
fromAddr - Mail fromtoAddr - Mail toccAddr - Mail ccbccAddr - Mail bccvcontext - The Velocity context to prepare
public boolean sendMail(Mail mailItem,
com.xpn.xwiki.XWikiContext context)
throws javax.mail.MessagingException,
UnsupportedEncodingException
mailItem - The Mail to send
javax.mail.MessagingException
UnsupportedEncodingException
public boolean sendMail(Mail mailItem,
MailConfiguration mailConfiguration,
com.xpn.xwiki.XWikiContext context)
throws javax.mail.MessagingException,
UnsupportedEncodingException
mailItem - The Mail to send
javax.mail.MessagingException
UnsupportedEncodingException
public boolean sendMails(Collection<Mail> emails,
com.xpn.xwiki.XWikiContext context)
throws javax.mail.MessagingException,
UnsupportedEncodingException
emails - Mail Collection
javax.mail.MessagingException
UnsupportedEncodingException
public boolean sendMails(Collection<Mail> emails,
MailConfiguration mailConfiguration,
com.xpn.xwiki.XWikiContext context)
throws javax.mail.MessagingException,
UnsupportedEncodingException
emails - Mail Collection
javax.mail.MessagingException
UnsupportedEncodingException
public int sendMailFromTemplate(String templateDocFullName,
String from,
String to,
String cc,
String bcc,
String language,
org.apache.velocity.VelocityContext vcontext,
com.xpn.xwiki.XWikiContext context)
throws com.xpn.xwiki.XWikiException
templateDocFullName - Full name of the template to be used (example: XWiki.MyEmailTemplate). The template
needs to have an XWiki.Email object attachedfrom - Email senderto - Email recipientcc - Email Carbon Copybcc - Email Hidden Carbon Copylanguage - Language of the emailvcontext - Velocity context passed to the velocity renderer
com.xpn.xwiki.XWikiException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||