|
static void | sendMailToAssistants (String path, String subject, String message, Object data) |
|
static void | sendMailToAdmin (String subject, String message) |
|
static void | sendMailToRole (String role, String subject, String message, Object data) |
|
static void | sendMailToAssistantsAndAdmin (String path, String subject, String message, Object data) |
|
static void | sendMailToRoleAndAdmin (String role, String subject, String message, Object data) |
|
◆ MailPool()
org.turro.mail.impl.MailPool.MailPool |
( |
| ) |
|
◆ addCssFile()
void org.turro.mail.impl.MailPool.addCssFile |
( |
String |
cssFile | ) |
|
Definition at line 175 of file elephant/src/main/java/org/turro/mail/impl/MailPool.java.
176 if(cssFiles.isEmpty()) {
178 if(!Strings.isBlank(cssS)) {
179 String[] cssA = cssS.split(
",");
180 for(String css1 : cssA) {
181 cssFiles.add(ElephantContext.getRealPath(css1));
185 cssFiles.add(cssFile);
KeyValueMap getAttributes()
◆ addToPool()
void org.turro.mail.impl.MailPool.addToPool |
( |
String |
from, |
|
|
String |
to, |
|
|
String |
cc, |
|
|
String |
subject, |
|
|
String |
message, |
|
|
String |
content |
|
) |
| |
Definition at line 74 of file elephant/src/main/java/org/turro/mail/impl/MailPool.java.
91 MimeMessage msg =
new MimeMessage(
session);
94 msg.setFrom(
new InternetAddress(from));
95 }
else if (poolFrom !=
null) {
96 msg.setFrom(
new InternetAddress(poolFrom));
100 msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to,
false));
103 msg.setRecipients(Message.RecipientType.CC, InternetAddress.parse(cc,
false));
105 msg.setSubject(cleanSubject(subject), encoding);
107 message =
template ==
null ? message :
template.replaceAll(
"\\#body", Parser.escapeGrouping(message));
109 if (content ==
null) {
110 msg.setText(addStyles(message), encoding);
112 msg.setContent(addStyles(message), content +
";charset=\"" + encoding +
"\"");
114 msg.setHeader(
"X-Mailer",
"Elephant Mail System");
115 msg.setHeader(
"Content-Transfer-Encoding",
"quoted-printable");
116 msg.setSentDate(date);
120 Logger.getLogger(
MailPool.class.getName()).log(Level.INFO,
"Added mail from {0} to {1}. Subject: {2}",
121 new Object[]{InternetAddress.toString(msg.getFrom()),
122 InternetAddress.toString(msg.getAllRecipients()), msg.getSubject()});
124 }
catch (MessagingException mex) {
125 Logger.getLogger(
MailPool.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), mex);
String getTemplateString(String attribute)
◆ getMailSession()
Session org.turro.mail.impl.MailPool.getMailSession |
( |
| ) |
throws MessagingException |
|
protected |
Definition at line 145 of file elephant/src/main/java/org/turro/mail/impl/MailPool.java.
149 Session tmpSession =
null;
151 if (mailhost.startsWith(
"java:")) {
153 InitialContext ic =
new InitialContext();
154 tmpSession = (Session) ic.lookup(mailhost);
155 }
catch (NamingException ex) {
156 Logger.getLogger(
MailPool.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
157 throw new MessagingException(
"Naming problem with: " + mailhost +
"\n\n" + ex.getExplanation());
160 Properties props = System.getProperties();
161 tmpSession = Session.getDefaultInstance(props,
null);
162 if (mailhost !=
null) {
163 props.put(
"mail.smtp.host", mailhost);
166 props.put(
"mail.smtp.auth",
"true");
168 props.put(
"mail.smtp.auth",
"false");
◆ getTemplateString()
String org.turro.mail.impl.MailPool.getTemplateString |
( |
String |
attribute | ) |
|
◆ sendMailToAdmin()
static void org.turro.mail.impl.MailPool.sendMailToAdmin |
( |
String |
subject, |
|
|
String |
message |
|
) |
| |
|
static |
Definition at line 247 of file elephant/src/main/java/org/turro/mail/impl/MailPool.java.
248 MailPool mp = (
MailPool) ContextFactory.getImplementation(HeadlessApplication.getInstance().getConstructor(),
"IMailPool");
249 mp.setEncoding(ElephantContext.getEncoding());
250 mp.addCssFile(ElephantContext.getRealPath(
"/_internal/css/mail.css"));
251 mp.addToPool(
null,
null,
null, subject +
" : " + ElephantContext.getSiteName(),
252 StringParser.toHTML(message),
"text/html");
◆ sendMailToAssistants()
static void org.turro.mail.impl.MailPool.sendMailToAssistants |
( |
String |
path, |
|
|
String |
subject, |
|
|
String |
message, |
|
|
Object |
data |
|
) |
| |
|
static |
Definition at line 232 of file elephant/src/main/java/org/turro/mail/impl/MailPool.java.
233 AssistantSet al =
new AssistantSet();
234 Assistants.addAssistants(path,
true, al, data);
236 MailPool mp = (
MailPool) ContextFactory.getImplementation(HeadlessApplication.getInstance().getConstructor(),
"IMailPool");
237 mp.setEncoding(ElephantContext.getEncoding());
238 mp.addCssFile(ElephantContext.getRealPath(
"/_internal/css/mail.css"));
239 for(Assistant a : al) {
240 mp.addToPool(
null, a.email,
null, subject +
" : " + ElephantContext.getSiteName(),
241 StringParser.toHTML(al.getSubject() +
"\n\n" + message),
"text/html");
◆ sendMailToAssistantsAndAdmin()
static void org.turro.mail.impl.MailPool.sendMailToAssistantsAndAdmin |
( |
String |
path, |
|
|
String |
subject, |
|
|
String |
message, |
|
|
Object |
data |
|
) |
| |
|
static |
Definition at line 271 of file elephant/src/main/java/org/turro/mail/impl/MailPool.java.
272 MailPool mp = (
MailPool) ContextFactory.getImplementation(HeadlessApplication.getInstance().getConstructor(),
"IMailPool");
273 mp.setEncoding(ElephantContext.getEncoding());
274 mp.addCssFile(ElephantContext.getRealPath(
"/_internal/css/mail.css"));
275 AssistantSet al =
new AssistantSet();
276 Assistants.addAssistants(path,
true, al, data);
277 String to = (String) mp.getAttributes().get(
"to");
279 al.add(
new Assistant(
null, to,
null,
null));
282 for(Assistant a : al) {
283 mp.addToPool(
null, a.email,
null, subject +
" : " + ElephantContext.getSiteName(),
284 StringParser.toHTML(al.getSubject() +
"\n\n" + message),
"text/html");
◆ sendMailToRole()
static void org.turro.mail.impl.MailPool.sendMailToRole |
( |
String |
role, |
|
|
String |
subject, |
|
|
String |
message, |
|
|
Object |
data |
|
) |
| |
|
static |
Definition at line 256 of file elephant/src/main/java/org/turro/mail/impl/MailPool.java.
257 AssistantSet al =
new AssistantSet();
258 Assistants.addAssistants(role, al, data);
260 MailPool mp = (
MailPool) ContextFactory.getImplementation(HeadlessApplication.getInstance().getConstructor(),
"IMailPool");
261 mp.setEncoding(ElephantContext.getEncoding());
262 mp.addCssFile(ElephantContext.getRealPath(
"/_internal/css/mail.css"));
263 for(Assistant a : al) {
264 mp.addToPool(
null, a.email,
null, subject +
" : " + ElephantContext.getSiteName(),
265 StringParser.toHTML(al.getSubject() +
"\n\n" + message),
"text/html");
◆ sendMailToRoleAndAdmin()
static void org.turro.mail.impl.MailPool.sendMailToRoleAndAdmin |
( |
String |
role, |
|
|
String |
subject, |
|
|
String |
message, |
|
|
Object |
data |
|
) |
| |
|
static |
Definition at line 290 of file elephant/src/main/java/org/turro/mail/impl/MailPool.java.
291 MailPool mp = (
MailPool) ContextFactory.getImplementation(HeadlessApplication.getInstance().getConstructor(),
"IMailPool");
292 mp.setEncoding(ElephantContext.getEncoding());
293 mp.addCssFile(ElephantContext.getRealPath(
"/_internal/css/mail.css"));
294 AssistantSet al =
new AssistantSet();
295 Assistants.addAssistants(role, al, data);
296 String to = (String) mp.getAttributes().get(
"to");
298 al.add(
new Assistant(
null, to,
null,
null));
301 for(Assistant a : al) {
302 mp.addToPool(
null, a.email,
null, subject +
" : " + ElephantContext.getSiteName(),
303 StringParser.toHTML(al.getSubject() +
"\n\n" + message),
"text/html");
◆ sendPool()
void org.turro.mail.impl.MailPool.sendPool |
( |
| ) |
|
◆ setEncoding()
void org.turro.mail.impl.MailPool.setEncoding |
( |
String |
encoding | ) |
|
◆ session
Session org.turro.mail.impl.MailPool.session = null |
|
protected |
The documentation for this class was generated from the following file: