|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.util.functions.FunctionProvider
org.mmbase.util.functions.DescribedFunctionProvider
org.mmbase.module.Module
org.mmbase.module.ReloadableModule
org.mmbase.module.WatchedReloadableModule
org.mmbase.applications.email.AbstractSendMail
org.mmbase.applications.email.SendMail
public class SendMail
Module providing mail functionality based on JavaMail, mail-resources.
| Field Summary | |
|---|---|
static String |
DEFAULT_MAIL_ENCODING
|
static long |
emailFailed
|
static long |
emailSent
|
static String |
mailEncoding
|
protected static Set<String> |
RECOGNIZED_HEADERS
|
protected javax.mail.Session |
session
|
| Fields inherited from class org.mmbase.module.Module |
|---|
configurationPath, getMaintainerFunction, getVersionFunction, properties, STATE_START_TIME |
| Fields inherited from class org.mmbase.util.functions.DescribedFunctionProvider |
|---|
description, guiName, name |
| Fields inherited from class org.mmbase.util.functions.FunctionProvider |
|---|
functions, getFunctions |
| Constructor Summary | |
|---|---|
SendMail()
|
|
SendMail(String name)
|
|
| Method Summary | |
|---|---|
protected javax.mail.internet.MimeMessage |
constructMessage(String from,
javax.mail.internet.InternetAddress[] to,
Map<String,String> headers)
Utility method to do the generic job of creating a MimeMessage object and setting its recipients and 'from'. |
protected Set<String> |
getDomains()
Returns the domains that are te be consided 'local' domains. |
String |
getModuleInfo()
Provide some info on the module; By default, this returns the module description for the default locale |
javax.mail.Session |
getSession()
|
String |
getTypeField()
|
void |
init()
Initializes the module. |
protected boolean |
isLocal(javax.mail.internet.InternetAddress recipient)
|
protected javax.mail.internet.InternetAddress[] |
parseOnly(String to)
Like InternetAddress#parse but leaves out the addresses not matching 'onlyTo'. |
void |
reload()
This method should be called when the module should be reloaded. |
void |
sendLocalMail(javax.mail.internet.InternetAddress[] to,
Node n)
Delivers the mail represented by an MMBase node 'locally'. |
boolean |
sendMail(Node n)
Send mail with headers AND attachments |
boolean |
sendMail(String onlyto,
Node n)
Send mail with headers AND attachments to the emailaddresses specified in the 'to' and 'cc' fields. |
boolean |
sendMail(String from,
String to,
String data,
Map<String,String> headers)
Send mail with headers, withouth using any explicit nodes. |
boolean |
sendMultiPartMail(String from,
String to,
Map<String,String> headers,
javax.mail.internet.MimeMultipart mmpart)
Sends a 'multipart' mail. |
protected void |
sendRemoteMail(javax.mail.internet.InternetAddress[] onlyto,
javax.mail.Address sender,
Node n)
Sends an email which is represented by an MMBase node. |
protected void |
sendRemoteMail(javax.mail.internet.InternetAddress[] onlyto,
Node n)
|
| Methods inherited from class org.mmbase.applications.email.AbstractSendMail |
|---|
sendMail, sendMail |
| Methods inherited from class org.mmbase.module.WatchedReloadableModule |
|---|
onload |
| Methods inherited from class org.mmbase.module.ReloadableModule |
|---|
reloadConfiguration, reloadConfiguration |
| Methods inherited from class org.mmbase.module.Module |
|---|
addInitParameters, checkModules, getInitParameter, getInitParameter, getInitParameter, getInitParameters, getInitParameters, getMaintainer, getModule, getModule, getModule, getModule, getModuleLoader, getModuleReader, getModuleReader, getModules, getState, getStates, getVersion, hasModule, hasStarted, loadInitParameters, loadInitParameters, maintainance, setInitParameter, setMaintainer, setState, setVersion, shutdown, shutdownModules, startModule, startModules |
| Methods inherited from class org.mmbase.util.functions.DescribedFunctionProvider |
|---|
getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName, setName |
| Methods inherited from class org.mmbase.util.functions.FunctionProvider |
|---|
addFunction, createParameters, getFunction, getFunctions, getFunctionValue, newFunctionInstance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_MAIL_ENCODING
public static String mailEncoding
public static long emailSent
public static long emailFailed
protected javax.mail.Session session
protected static final Set<String> RECOGNIZED_HEADERS
| Constructor Detail |
|---|
public SendMail()
public SendMail(String name)
| Method Detail |
|---|
protected Set<String> getDomains()
public void sendLocalMail(javax.mail.internet.InternetAddress[] to,
Node n)
protected javax.mail.internet.InternetAddress[] parseOnly(String to)
throws javax.mail.MessagingException
javax.mail.MessagingException
public boolean sendMultiPartMail(String from,
String to,
Map<String,String> headers,
javax.mail.internet.MimeMultipart mmpart)
throws javax.mail.MessagingException
AbstractSendMail
sendMultiPartMail in class AbstractSendMailtrue Could in principle return false on
failure. But that would normally result an exception.
- Throws:
javax.mail.MessagingExceptionpublic String getModuleInfo()
getModuleInfo in class Modulepublic void reload()
ReloadableModule
reload in class ReloadableModulepublic void init()
Module.startModule(), which makes sure it is not called
more than once. You should not call init() directly, call startModule() instead.
init in class Module
protected final javax.mail.internet.MimeMessage constructMessage(String from,
javax.mail.internet.InternetAddress[] to,
Map<String,String> headers)
throws javax.mail.MessagingException
javax.mail.MessagingException
public boolean sendMail(String from,
String to,
String data,
Map<String,String> headers)
sendMail in class AbstractSendMail
protected void sendRemoteMail(javax.mail.internet.InternetAddress[] onlyto,
Node n)
protected void sendRemoteMail(javax.mail.internet.InternetAddress[] onlyto,
javax.mail.Address sender,
Node n)
sender - If this is a forward, then you'd want to set the sender to the local address
(see rfc 822 4.4.4)public boolean sendMail(Node n)
protected boolean isLocal(javax.mail.internet.InternetAddress recipient)
public boolean sendMail(String onlyto,
Node n)
public javax.mail.Session getSession()
public String getTypeField()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||