|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--com.opencms.defaults.CmsMail
This class is used to send a mail using the JavaMail package.
Sun's mail.jar and activation.jar are required,
if this class should be used in any OpenCms class.
Sender and recipients addresses may be given as String
or as CmsUser objects.
Different constructors for setting additional CC and BCC addresses are provided.
Attachments can be added using the addAttachment() method.
If the current HTTP request is a multipart/form-data request
and contains uploaded files, all these files will be sent as attachments, too.
For performance reasons, this classes uses threads for sending mails. Mail threads can be initialized and started by :
start() method on this object.
Example:
String from = "waruschan.babachan@framfab.de";
String[] to = {"alexander.lucas@framfab.de"};
String subject = "Testmail";
String content = "Hello World!";
CmsMail mail=new CmsMail(cms, from, to, subject, content, "text/plain");
mail.start();
com.opencms.workplace package.| Field Summary |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Fields inherited from interface com.opencms.boot.I_CmsLogChannels |
C_FLEX_CACHE, C_FLEX_LOADER, C_LOGGING, C_MODULE_CRITICAL, C_MODULE_DEBUG, C_MODULE_INFO, C_OPENCMS_CACHE, C_OPENCMS_CRITICAL, C_OPENCMS_CRONSCHEDULER, C_OPENCMS_DEBUG, C_OPENCMS_ELEMENTCACHE, C_OPENCMS_INFO, C_OPENCMS_INIT, C_OPENCMS_POOL, C_OPENCMS_STATICEXPORT, C_OPENCMS_STREAMING, C_PREPROCESSOR_IS_LOGGING |
| Constructor Summary | |
CmsMail(CmsObject cms,
CmsUser from,
CmsGroup to,
String subject,
String content,
String type)
Create a new email object with a CmsUser as sender and a
CmsGroup as recipient(s). |
|
CmsMail(CmsObject cms,
CmsUser from,
CmsUser[] to,
String subject,
String content,
String type)
Create a new email object with a CmsUser as sender and an array of
CmsUser's as recipient(s). |
|
CmsMail(CmsObject cms,
String from,
String[] to,
String[] cc,
boolean isBcc,
String subject,
String content,
String type)
Create a new email object with given FROM, TO and BCC addresses. |
|
CmsMail(CmsObject cms,
String from,
String[] to,
String[] cc,
String[] bcc,
String subject,
String content,
String type)
Create a new email object with given FROM, TO, CC and BCC addresses. |
|
CmsMail(CmsObject cms,
String from,
String[] to,
String[] bcc,
String subject,
String content,
String type)
Create a new email object with given FROM, TO and BCC addresses. |
|
CmsMail(CmsObject cms,
String from,
String[] to,
String subject,
String content,
String type)
Create a new email object with given FROM and TO addresses. |
|
CmsMail(CmsUser from,
CmsGroup to,
String subject,
String content,
String type)
|
|
CmsMail(CmsUser from,
CmsUser[] to,
String subject,
String content,
String type)
|
|
CmsMail(String from,
String[] to,
String[] cc,
String[] bcc,
String subject,
String content,
String type)
|
|
CmsMail(String from,
String[] to,
String[] bcc,
String subject,
String content,
String type)
|
|
CmsMail(String from,
String[] to,
String subject,
String content,
String type)
The constuctors without CmsObject |
|
| Method Summary | |
void |
addAttachment(String content,
String type)
Add a new attachment of the given content type to this CmsMail
object. |
protected String |
getClassName()
Helper method for printing nice classnames in error messages |
void |
run()
Try sending the mail. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public CmsMail(String from,
String[] to,
String subject,
String content,
String type)
throws CmsException
public CmsMail(CmsUser from,
CmsUser[] to,
String subject,
String content,
String type)
throws CmsException
public CmsMail(CmsUser from,
CmsGroup to,
String subject,
String content,
String type)
throws CmsException
public CmsMail(String from,
String[] to,
String[] cc,
String[] bcc,
String subject,
String content,
String type)
throws CmsException
public CmsMail(String from,
String[] to,
String[] bcc,
String subject,
String content,
String type)
throws CmsException
public CmsMail(CmsObject cms,
CmsUser from,
CmsUser[] to,
String subject,
String content,
String type)
throws CmsException
CmsUser as sender and an array of
CmsUser's as recipient(s). Email addresses will be taken from
the CmsUser properties.
cms - Cms objectfrom - User object that contains the address of sender.to - User object that contains the address of recipient.subject - Subject of email.content - Content of email.type - ContentType of email.
public CmsMail(CmsObject cms,
CmsUser from,
CmsGroup to,
String subject,
String content,
String type)
throws CmsException
CmsUser as sender and a
CmsGroup as recipient(s). The sender's address will be taken from
the CmsUser properties, the recipient's addresses from all CmsUsers
belonging to the given group.
cms - Cms object.from - User object that contains the address of sender.to - Group object that contains the address of recipient.subject - Subject of email.content - Content of email.type - ContentType of email.
public CmsMail(CmsObject cms,
String from,
String[] to,
String[] cc,
String[] bcc,
String subject,
String content,
String type)
throws CmsException
cms - Cms object.from - Address of sender.to - Address of recipient.cc - Address of copy recipient.bcc - Address of blank copy recipient.subject - Subject of email.content - Content of email.type - ContentType of email.CmsMail(CmsObject,String, String[], String[], String, String, String)
public CmsMail(CmsObject cms,
String from,
String[] to,
String[] bcc,
String subject,
String content,
String type)
throws CmsException
cms - Cms object.from - Address of sender.to - Address of recipient.bcc - Address of blank copy recipient.subject - Subject of email.content - Content of email.type - ContentType of email.CmsMail(CmsObject,String, String[], String, String, String)
public CmsMail(CmsObject cms,
String from,
String[] to,
String[] cc,
boolean isBcc,
String subject,
String content,
String type)
throws CmsException
cms - Cms object.from - Address of sender.to - Address of recipient.cc - Address of copy recipient.isBcc - dedined wheather the type of cc is a bcc or not.subject - Subject of email.content - Content of email.type - ContentType of email.CmsMail(CmsObject,String, String[], String, String, String)
public CmsMail(CmsObject cms,
String from,
String[] to,
String subject,
String content,
String type)
throws CmsException
cms - Cms object.from - Address of sender.to - Array with address(es) of recipient(s).subject - Subject of email.content - Content of email.type - ContentType of email.| Method Detail |
public void addAttachment(String content,
String type)
CmsMail
object. The attachment will get a random name.
content - Content of the attachment.type - Content type of the attachment.protected String getClassName()
public void run()
run in interface Runnablerun in class Thread
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||