|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.mail.MailManager
public class MailManager
Provides convenient methods to manage DBMailMessage stored in DataBase and on HardDrive
Field Summary | |
---|---|
static String |
REVISION
|
static String |
SEND_WITH_SITE_EMAIL
Name of both JCMS property and context map attribute defining a MailMessage behavior. |
Method Summary | |
---|---|
static String |
addAuthKeyToImagesSrc(String content,
Member mbr)
When the site is private, add an authentication key to all src='...' URL in order for the mailer to access them without any authentication. |
static String |
buildContentFromJsp(String jspPath,
Member loggedMember,
String language,
HashMap<Object,Object> requestAttributeMap,
HashMap<Object,Object> sessionAttributeMap)
Builds a mail content from a given jsp |
MailMessage |
createDBMailMessage(javax.mail.Message msg,
MailAccount account)
Build a DBMessage from a Message and save in into the DB |
MailMessage |
getDBMailMessage(javax.mail.Message msg)
Returns the DBMailMessage for the given Message |
MailMessage |
getDBMailMessage(String msgid)
Returns the DBMailMessage for the given Message Id |
int |
getDBMailMessageCount()
Returns the count of DBMailMessage |
int |
getDBMailMessageCount(String account)
Returns the count of DBMailMessage for given account |
Collection<? extends MailMessage> |
getDBMailMessageReplies(String msgid)
Returns the DBMailMessage for the given Message Id |
Set<Object> |
getDBMailMessageSet(String[] ids)
Returns a Collection of MailMessage or Message-ID (if not found) |
Collection<? extends MailMessage> |
getDBMailMessageThread(String thread)
|
static Set<javax.mail.internet.InternetAddress> |
getIAFromMemberSet(Set<Member> mbrSet)
Returns a Set of InternetAddress build from a Set of Members |
static String |
getIncomingAddress(String localpart,
Member mbr,
String label)
Returns JCMS incoming email for the given Member |
static MailManager |
getInstance()
|
static TreeSet<String> |
getInvalidEmailSet(Set<String> mailSet,
Set<Member> mbrSet)
Retrieve all INVALID email from the specified mail and member Set. |
static String |
getLocalPartSuffixAuthKey(Member mbr)
Returns a localpart sufix authkey for given members |
MailFetcher |
getMailFetcher()
Returns the MailFetcher |
String |
getMessageIdQuietly(javax.mail.Message msg)
Convenient method that delegate to MailFetcher method |
static void |
improveMailMessageConformity(MailMessage msg,
HashMap<String,Object> ctxt)
Improve the specified MailMessage conformity with mail sending best practices (if enabled). |
void |
init()
|
static String |
replaceRelativeUrlsWithAbsoluteUrls(String contentHtml)
Convert all relative URLs inside the specified HTML content into absolute URL. |
void |
saveDBMailMessage(MailMessage mail,
Map<String,Object> context)
Build a DBMessage from a Message and save in into the DB |
File |
writeEml(javax.mail.Message msg)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
public static final String SEND_WITH_SITE_EMAIL
The value is a boolean which defines if MailMessage should be sent using the
Member name and e-mail, or using the user name but with the site e-mail address.
If set to true
, mail are sent using the site default email address,
and the original Member is used in the ReplyTo header.
If set to false
, mail are sent using original member email address.
Value can be specified :
MailMessage.send(HashMap)
method (this value overrides the behavior of JCMS property)
Method Detail |
---|
public static MailManager getInstance()
public void init()
public static void improveMailMessageConformity(MailMessage msg, HashMap<String,Object> ctxt)
Implementation details
If following criterias are met :
mail.send-with-site-email
is set to true
mail.send-with-site-email
is either undefined or
set to true
in the context map (this attribute overrides behavior of JCMS property)MailMessage.getFromMember()
is not null
MailMessage.getReplyToMember()
is null
or is the same member specified in MailMessage.getFromMember()
"{Member Full Name} ({Site Name}) <{default-email or admin-email}>"
msg
- the MailMessage to modify if criterias are metctxt
- the context map attribute of MailMessage.send(HashMap)
, MUST NOT be nullpublic static String addAuthKeyToImagesSrc(String content, Member mbr)
content
- html content to updatembr
- the recipient member
public static String replaceRelativeUrlsWithAbsoluteUrls(String contentHtml)
Uses the current channel URL as prefix of relative URL.
contentHtml
- the HTML content in which to look for relative URL (in src and href attributes)
public Set<Object> getDBMailMessageSet(String[] ids)
ids
- a list of Message-ID
public int getDBMailMessageCount()
public int getDBMailMessageCount(String account)
account
- the account name
public MailMessage getDBMailMessage(javax.mail.Message msg)
msg
- a javax.mail.Message
public MailMessage getDBMailMessage(String msgid)
msgid
- the message id
public Collection<? extends MailMessage> getDBMailMessageReplies(String msgid)
msgid
- the message id
public Collection<? extends MailMessage> getDBMailMessageThread(String thread)
public MailMessage createDBMailMessage(javax.mail.Message msg, MailAccount account)
msg
- a javax.mail.Messageaccount
- the mailAccount
public void saveDBMailMessage(MailMessage mail, Map<String,Object> context)
mail
- the MailMessagecontext
- the contextual mappublic File writeEml(javax.mail.Message msg)
public MailFetcher getMailFetcher()
public String getMessageIdQuietly(javax.mail.Message msg)
msg
- the javax.mail.Message
MailFetcher.getMessageIdQuietly(Message)
public static String getIncomingAddress(String localpart, Member mbr, String label)
localpart
- the mail prefixmbr
- Member author of the maillabel
- the email label
public static String getLocalPartSuffixAuthKey(Member mbr)
mbr
- the member
public static Set<javax.mail.internet.InternetAddress> getIAFromMemberSet(Set<Member> mbrSet) throws javax.mail.MessagingException
mbrSet
- a Set of Members
javax.mail.MessagingException
public static TreeSet<String> getInvalidEmailSet(Set<String> mailSet, Set<Member> mbrSet)
mailSet
- a set of email addressesmbrSet
- a set of Member
public static String buildContentFromJsp(String jspPath, Member loggedMember, String language, HashMap<Object,Object> requestAttributeMap, HashMap<Object,Object> sessionAttributeMap)
jspPath
- the jsp to processloggedMember
- the loggedMemberlanguage
- the user languagerequestAttributeMap
- Map of request attributessessionAttributeMap
- Map of session attributes
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |