BrightSide Workbench Full Report + Source Code
org.turro.mail.impl.MailUtils Class Reference

Static Public Member Functions

static boolean silentEmailCheck (String emails)
 
static boolean isValidEmailAddress (String emails)
 
static String processMacrosForWeb (IContact contact, String message)
 
static String processMacros (IContact contact, String message)
 
static String processLinks (IContact contact, String message)
 
static String processLinks (String email, String message)
 
static String cleanLinks (String message)
 
static String processLiveLinks (String email, String message)
 
static String processLiveRefs (String email, String message)
 
static String cleanLiveLinks (String message)
 
static String cleanLiveRefs (String message)
 
static String processImgWidth (String message)
 
static String processUser (IContact contact, String message)
 
static String processUser (String email, String name, String message)
 
static String processUser (Recipient recipient, String message)
 

Detailed Description

Member Function Documentation

◆ cleanLinks()

static String org.turro.mail.impl.MailUtils.cleanLinks ( String  message)
static

Definition at line 96 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

96  {
97  message = cleanLiveLinks(message);
98  message = cleanLiveRefs(message);
99  return message;
100  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanLiveLinks()

static String org.turro.mail.impl.MailUtils.cleanLiveLinks ( String  message)
static

Definition at line 146 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

146  {
147  if(message.contains("{livelink")) {
148  Pattern pat = Pattern.compile(LIVE_LINK_PATTERN);
149  Matcher mat = pat.matcher(message);
150  StringBuffer result = new StringBuffer();
151  while(mat.find()) {
152  try {
153  if(mat.groupCount() > 1 && !Strings.isBlank(mat.group(1)) && !Strings.isBlank(mat.group(2))) {
154  mat.appendReplacement(result, "<a href='" + mat.group(2) + "'>" + mat.group(1) + "</a>");
155  }
156  } catch (Exception ex) {
157  Logger.getLogger(MailUtils.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
158  }
159  }
160  mat.appendTail(result);
161  return result.toString();
162  }
163  return message;
164  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanLiveRefs()

static String org.turro.mail.impl.MailUtils.cleanLiveRefs ( String  message)
static

Definition at line 166 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

166  {
167  if(message.contains("{liveref")) {
168  Pattern pat = Pattern.compile(LIVE_REF_PATTERN);
169  Matcher mat = pat.matcher(message);
170  StringBuffer result = new StringBuffer();
171  while(mat.find()) {
172  try {
173  if(mat.groupCount() > 0 && !Strings.isBlank(mat.group(1))) {
174  mat.appendReplacement(result, mat.group(1));
175  }
176  } catch (Exception ex) {
177  Logger.getLogger(MailUtils.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
178  }
179  }
180  mat.appendTail(result);
181  return result.toString();
182  }
183  return message;
184  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isValidEmailAddress()

static boolean org.turro.mail.impl.MailUtils.isValidEmailAddress ( String  emails)
static

Definition at line 54 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

54  {
55  try {
56  for(InternetAddress ia : InternetAddress.parse(emails, true)) {
57  ia.validate();
58  }
59  return true;
60  } catch (AddressException ex) {
61  Logger.getLogger(MailUtils.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(emails), ex);
62  }
63  return false;
64  }
Here is the call graph for this function:

◆ processImgWidth()

static String org.turro.mail.impl.MailUtils.processImgWidth ( String  message)
static

Definition at line 192 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

192  {
193  return message.replaceAll("\\<img ", "<img style=\"max-width:100%\" ");
194  }
Here is the caller graph for this function:

◆ processLinks() [1/2]

static String org.turro.mail.impl.MailUtils.processLinks ( IContact  contact,
String  message 
)
static

Definition at line 80 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

80  {
81  if(contact != null && contact.isValid() && contact.isWebUser()) {
82  String email = contact.getConnector(IUser.CONNECTOR_EMAIL);
83  message = processLinks(email, message);
84  } else {
85  message = cleanLinks(message);
86  }
87  return message;
88  }
static String processLinks(IContact contact, String message)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processLinks() [2/2]

static String org.turro.mail.impl.MailUtils.processLinks ( String  email,
String  message 
)
static

Definition at line 90 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

90  {
91  message = processLiveLinks(email, message);
92  message = processLiveRefs(email, message);
93  return message;
94  }
static String processLiveRefs(String email, String message)
static String processLiveLinks(String email, String message)
Here is the call graph for this function:

◆ processLiveLinks()

static String org.turro.mail.impl.MailUtils.processLiveLinks ( String  email,
String  message 
)
static

Definition at line 102 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

102  {
103  if(message.contains("{livelink")) {
104  Pattern pat = Pattern.compile(LIVE_LINK_PATTERN);
105  Matcher mat = pat.matcher(message);
106  StringBuffer result = new StringBuffer();
107  while(mat.find()) {
108  try {
109  if(mat.groupCount() > 1 && !Strings.isBlank(mat.group(1)) && !Strings.isBlank(mat.group(2))) {
110  String server = ElephantContext.getServerUrl("http") + "?" +
111  Actions.createActionFromElephant(email, URLDecoder.decode(mat.group(2), StandardCharsets.UTF_8.name()));
112  mat.appendReplacement(result, "<a href=\"" + server + "\">" + mat.group(1) + "</a>");
113  }
114  } catch (Exception ex) {
115  Logger.getLogger(MailUtils.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
116  }
117  }
118  mat.appendTail(result);
119  return result.toString();
120  }
121  return message;
122  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processLiveRefs()

static String org.turro.mail.impl.MailUtils.processLiveRefs ( String  email,
String  message 
)
static

Definition at line 124 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

124  {
125  if(message.contains("{liveref")) {
126  Pattern pat = Pattern.compile(LIVE_REF_PATTERN);
127  Matcher mat = pat.matcher(message);
128  StringBuffer result = new StringBuffer();
129  while(mat.find()) {
130  try {
131  if(mat.groupCount() > 0 && !Strings.isBlank(mat.group(1))) {
132  String server = ElephantContext.getServerUrl("http") + "?" +
133  Actions.createActionFromElephant(email, URLDecoder.decode(mat.group(1), StandardCharsets.UTF_8.name()));
134  mat.appendReplacement(result, server);
135  }
136  } catch (Exception ex) {
137  Logger.getLogger(MailUtils.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
138  }
139  }
140  mat.appendTail(result);
141  return result.toString();
142  }
143  return message;
144  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processMacros()

static String org.turro.mail.impl.MailUtils.processMacros ( IContact  contact,
String  message 
)
static

Definition at line 72 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

72  {
73  message = processLinks(contact, message);
74  message = processUser(contact, message);
75  return message;
76  }
static String processUser(IContact contact, String message)
Here is the call graph for this function:

◆ processMacrosForWeb()

static String org.turro.mail.impl.MailUtils.processMacrosForWeb ( IContact  contact,
String  message 
)
static

Definition at line 66 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

66  {
67  message = cleanLinks(message);
68  message = processUser(contact, message);
69  return message;
70  }
Here is the call graph for this function:

◆ processUser() [1/3]

static String org.turro.mail.impl.MailUtils.processUser ( IContact  contact,
String  message 
)
static

Definition at line 198 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

198  {
199  if(contact != null && contact.isValid() && contact.isWebUser()) {
200  message = processUser(Recipient.of(contact), message);
201  }
202  return message;
203  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processUser() [2/3]

static String org.turro.mail.impl.MailUtils.processUser ( Recipient  recipient,
String  message 
)
static

Definition at line 209 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

209  {
210  if(!recipient.isEmpty()) {
211  message = recipient.parse(message);
212  }
213  return message;
214  }
Here is the call graph for this function:

◆ processUser() [3/3]

static String org.turro.mail.impl.MailUtils.processUser ( String  email,
String  name,
String  message 
)
static

Definition at line 205 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

205  {
206  return processUser(Recipient.of(email, name), message);
207  }
Here is the call graph for this function:

◆ silentEmailCheck()

static boolean org.turro.mail.impl.MailUtils.silentEmailCheck ( String  emails)
static

Definition at line 42 of file elephant/src/main/java/org/turro/mail/impl/MailUtils.java.

42  {
43  try {
44  for(InternetAddress ia : InternetAddress.parse(emails, true)) {
45  ia.validate();
46  }
47  return true;
48  } catch (AddressException ex) {
49  return false;
50  }
51  }

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