BrightSide Workbench Full Report + Source Code
org.turro.mail.sender.MailPool Class Reference
Inheritance diagram for org.turro.mail.sender.MailPool:
Collaboration diagram for org.turro.mail.sender.MailPool:

Protected Member Functions

void doSend (NotificationCategory category, String subject, String message)
 
void doSendTemplate (NotificationCategory category, Object entity, String template, String subject) throws EmailException
 
- Protected Member Functions inherited from org.turro.mail.sender.AbstractMailSender
boolean isFromValid ()
 
String getFromString ()
 
Map getAttributes ()
 

Additional Inherited Members

- Public Member Functions inherited from org.turro.mail.sender.AbstractMailSender
IMailSender setCategory (String idCategory)
 
IMailSender setReason (String reason)
 
IMailSender setPool (String pool)
 
IMailSender setFrom (IContact from)
 
IMailSender setRoot (String root)
 
IMailSender addAdministrators ()
 
IMailSender addBySyndication (String syndication)
 
IMailSender addByRole (String role)
 
IMailSender addByEntity (Object entity, Object data)
 
IMailSender addByEntity (Object entity, boolean deep, Object data)
 
IMailSender addByEntity (String path, Object data)
 
IMailSender addByEntity (String path, boolean deep, Object data)
 
IMailSender addContact (IContact contact)
 
IMailSender addContacts (Collection< IContact > contacts)
 
IMailSender addAssistant (Assistant assistant)
 
IMailSender addAssistants (AssistantSet assistants)
 
IMailSender addUser (String name, String email)
 
IMailSender addAttachment (File file)
 
IMailSender addAttachments (Collection< File > files)
 
IMailSender addMailAttachments (Collection< MailAttachment > mas)
 
IMailSender onStart (Consumer command)
 
IMailSender onCancel (Consumer command)
 
IMailSender onBuild (Consumer command)
 
IMailSender onFinish (Consumer command)
 
AssistantSet getAssistants ()
 
void removeAttachments ()
 
IMailSender putIf (Object key, Supplier< Boolean > condition, Supplier value)
 
IMailSender put (Object key, Object value)
 
IMailSender putAll (Map attributes)
 
void send (String subject, String message)
 
void send (NotificationCategory category, String subject, String message)
 
void sendTemplate (String template, String subject) throws EmailException
 
void sendTemplate (Object entity, String template, String subject) throws EmailException
 
void sendTemplate (NotificationCategory category, Object entity, String template, String subject) throws EmailException
 
void silentSendTemplate (String template, String subject)
 
void silentSendTemplate (Object entity, String template, String subject)
 
void silentSendTemplate (NotificationCategory category, Object entity, String template, String subject)
 
String processMacros (IContact contact, String text, boolean web)
 
- Public Member Functions inherited from org.turro.action.IContactSender< IMailSender >
addAdministrators ()
 
addByEntity (Object entity, Object data)
 
addByEntity (Object entity, boolean deep, Object data)
 
addByEntity (String path, Object data)
 
addByEntity (String path, boolean deep, Object data)
 
addByRole (String role)
 
addBySyndication (String syndication)
 
addContact (IContact contact)
 
addContacts (Collection< IContact > contacts)
 
addAssistant (Assistant assistant)
 
addAssistants (AssistantSet assistants)
 
addUser (String name, String email)
 
AssistantSet getAssistants ()
 
default void copyFrom (IContactSender sender)
 
- Public Attributes inherited from org.turro.mail.sender.AbstractMailSender
final AssistantSet assistants = new AssistantSet()
 
- Protected Attributes inherited from org.turro.mail.sender.AbstractMailSender
String defaultCategory = GenericElephantNotification.SYSTEM_NOTIFICATION
 
String reason
 
Set< File > attachments = new HashSet<>()
 
Set< MailAttachmentmailAttachments = new HashSet<>()
 
Consumer onStart
 
IContact from
 

Detailed Description

Member Function Documentation

◆ doSend()

void org.turro.mail.sender.MailPool.doSend ( NotificationCategory  category,
String  subject,
String  message 
)
protected

Reimplemented from org.turro.mail.sender.AbstractMailSender.

Reimplemented in org.turro.mail.sender.MailHeavy.

Definition at line 48 of file elephant-mail/src/main/java/org/turro/mail/sender/MailPool.java.

48  {
49  if(category != null && !assistants.isEmpty()) {
50  IConstructor constructor = Application.getApplication().getConstructor();
51  MailMessagePool mp = MailProviders.instance().getPool(constructor, Strings.isBlank(pool, MailProviders.GENERIC));
52  for(Assistant a : assistants) {
53  MailMessage mmt = mp.addToPoolTemplate(getFromString(), a.email, null, subject + " : " + ElephantContext.getSiteName(),
54  StringParser.toHTML((Strings.isBlank(assistants.getSubject()) ? "" : assistants.getSubject() + "\n\n")) +
55  StringParser.toHTML(message),
56  null, a.name, null);
57  for(File file : attachments) {
58  mmt.attach(file.getAbsolutePath(), file.getName(), file.getName());
59  }
60  for(MailAttachment ma : mailAttachments) {
61  mmt.attach(ma.attachment.getAbsolutePath(), ma.name, ma.name);
62  }
63  }
64  mp.sendPool(onFinish);
65  }
66  }

◆ doSendTemplate()

void org.turro.mail.sender.MailPool.doSendTemplate ( NotificationCategory  category,
Object  entity,
String  template,
String  subject 
) throws EmailException
protected

Reimplemented from org.turro.mail.sender.AbstractMailSender.

Reimplemented in org.turro.mail.sender.MailHeavy.

Definition at line 71 of file elephant-mail/src/main/java/org/turro/mail/sender/MailPool.java.

71  {
72  if(category != null && !assistants.isEmpty()) {
73  IConstructor constructor = Application.getApplication().getConstructor();
74  MailMessagePool mp = MailProviders.instance().getPool(constructor, Strings.isBlank(pool, MailProviders.GENERIC));
75  for(Assistant a : assistants) {
76  MailMessageTemplate mmt = MailMessageTemplate.of(mp.getProvider());
77  if(!Strings.isBlank(root)) mmt.setRoot(root);
78  mmt.setSubject(subject);
79  mmt.addTo(a.email, a.name);
80  if(isFromValid()) {
81  mmt.setFrom(from.getEmail(), from.getName());
82  }
83  ElephantMarker em = new ElephantMarker(constructor, true);
84  if(entity != null) em.put("entity", entity);
85  if(a.contact != null) em.put("contact", a.contact);
86  em.put("email", a.email);
87  em.put("name", a.name);
88  em.putAll(getAttributes());
89  mmt.setMessage(em, template, a.email, a.name);
90  for(File file : attachments) {
91  mmt.attach(file.getAbsolutePath(), file.getName(), file.getName());
92  }
93  for(MailAttachment ma : mailAttachments) {
94  mmt.attach(ma.attachment.getAbsolutePath(), ma.name, ma.name);
95  }
96  mp.addToPool(mmt);
97  }
98  mp.sendPool(onFinish);
99  }
100  }

The documentation for this class was generated from the following file: