19 package org.turro.contacts.service;
21 import java.net.URLEncoder;
22 import java.util.HashMap;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
25 import org.apache.commons.mail.EmailException;
26 import org.turro.action.Actions;
27 import org.turro.action.queue.NotificationCategory;
28 import org.turro.assistant.Assistant;
29 import org.turro.assistant.AssistantSet;
30 import org.turro.auth.Authentication;
31 import org.turro.contacts.ContactService;
32 import org.turro.elephant.context.Application;
33 import org.turro.elephant.context.ElephantContext;
34 import org.turro.elephant.context.IConstructor;
35 import org.turro.elephant.security.IUser;
36 import org.turro.entities.Entities;
37 import org.turro.mail.message.MailMessageTemplate;
38 import org.turro.mail.provider.MailProviders;
39 import org.turro.mail.queue.GenericElephantNotification;
40 import org.turro.mail.queue.QueueManager;
41 import org.turro.marker.ElephantMarker;
42 import org.turro.plugin.contacts.IContact;
60 public void send(String
template, String reason) {
61 addToQueue(
template, reason);
71 HashMap<String, String> values =
new HashMap<>();
73 values.put(
Actions.REDIR_PAR, URLEncoder.encode(redir,
"UTF-8"));
84 return "{liveref:" + redir +
"}";
87 private void addToQueue(String
template, String reason) {
97 mmt.
addTo(assistant.email, assistant.name);
101 em.
put(
"contact", assistant.contact);
102 em.
put(
"email", assistant.email);
104 em.
put(
"notifier",
this);
106 mmt.
setMessage(em,
template, assistant.contact);
107 qm.
addToQueue(nc, assistant.contact, mmt, reason,
null);
109 }
catch (EmailException ex) {
116 return String.format(
"[%s %s] %s",
static String createAction(String email, String redir)
static final String USER_PAR
static IContact getIContact()
IConstructor getConstructor()
static Application getApplication()
static IElephantEntity getController(String path)
void setProcessLiveLinks(boolean processLiveLinks)
void setMessage(ElephantMarker marker, IContact contact)
static MailMessageTemplate of(MailProvider provider)
void setRoot(String root)
Email addTo(String email, String name)
void setSubject(String subject)
MailProvider getProvider(String name)
static MailProviders instance()
static final String GENERIC
static final String GENERIC_NOTIFICATION
NotificationCategory getCategory(String id)
MailItem addToQueue(NotificationCategory category, IContact contact, MailMessage mmt, String reason, String poolName)
boolean contactMayWant(IContact contact, String idCategory)
Object put(Object key, Object value)
static final String CONNECTOR_EMAIL