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

Public Member Functions

HtmlEmail getEmail ()
 
String getMessage ()
 
void setMessage (String message)
 
String getSubject ()
 
void setSubject (String subject)
 
MailProvider getProvider ()
 
void attachRelative (String path, String description, String name)
 
void attach (String path, String description, String name)
 
void attachExternal (URL url, String description, String name)
 
void embedRelative (String name, String path)
 
void embed (String name, File file)
 
void embedExternal (String name, String url) throws MalformedURLException
 
void send () throws EmailException, MalformedURLException, NamingException
 
Date getSentDate ()
 
void setSentDate (Date date)
 
Email setFrom (String email, String name) throws EmailException
 
Email setFrom (String email) throws EmailException
 
Email addTo (String email, String name) throws EmailException
 
Email addTo (String email) throws EmailException
 
Email addReplyTo (String email, String name) throws EmailException
 
Email addReplyTo (String email) throws EmailException
 
void addHeader (String name, String value)
 
Email addCc (String email, String name) throws EmailException
 
Email addCc (String email) throws EmailException
 
Email addBcc (String email, String name) throws EmailException
 
Email addBcc (String email) throws EmailException
 

Static Public Member Functions

static MailMessage of (MailProvider provider)
 

Protected Member Functions

 MailMessage (MailProvider provider)
 

Protected Attributes

final MailProvider provider
 

Detailed Description

Constructor & Destructor Documentation

◆ MailMessage()

org.turro.mail.message.MailMessage.MailMessage ( MailProvider  provider)
protected

Definition at line 219 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

219  {
220  this.provider = provider;
221  email.setCharset(ElephantContext.getEncoding());
222  }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ addBcc() [1/2]

Email org.turro.mail.message.MailMessage.addBcc ( String  email) throws EmailException

Definition at line 207 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

207  {
208  return this.email.addBcc(email);
209  }

◆ addBcc() [2/2]

Email org.turro.mail.message.MailMessage.addBcc ( String  email,
String  name 
) throws EmailException

Definition at line 203 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

203  {
204  return this.email.addBcc(email, name, ElephantContext.getEncoding());
205  }
Here is the call graph for this function:

◆ addCc() [1/2]

Email org.turro.mail.message.MailMessage.addCc ( String  email) throws EmailException

Definition at line 199 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

199  {
200  return this.email.addCc(email);
201  }

◆ addCc() [2/2]

Email org.turro.mail.message.MailMessage.addCc ( String  email,
String  name 
) throws EmailException

Definition at line 195 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

195  {
196  return this.email.addCc(email, name, ElephantContext.getEncoding());
197  }
Here is the call graph for this function:

◆ addHeader()

void org.turro.mail.message.MailMessage.addHeader ( String  name,
String  value 
)

Definition at line 191 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

191  {
192  email.addHeader(name, value);
193  }
Here is the caller graph for this function:

◆ addReplyTo() [1/2]

Email org.turro.mail.message.MailMessage.addReplyTo ( String  email) throws EmailException

Definition at line 187 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

187  {
188  return this.email.addReplyTo(email);
189  }

◆ addReplyTo() [2/2]

Email org.turro.mail.message.MailMessage.addReplyTo ( String  email,
String  name 
) throws EmailException

Definition at line 183 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

183  {
184  return this.email.addReplyTo(email, name, ElephantContext.getEncoding());
185  }
Here is the call graph for this function:

◆ addTo() [1/2]

Email org.turro.mail.message.MailMessage.addTo ( String  email) throws EmailException

Definition at line 178 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

178  {
179  if(Strings.isBlank(email)) return null;
180  return this.email.addTo(email);
181  }

◆ addTo() [2/2]

Email org.turro.mail.message.MailMessage.addTo ( String  email,
String  name 
) throws EmailException

Definition at line 173 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

173  {
174  if(Strings.isBlank(email)) return null;
175  return this.email.addTo(email, name, ElephantContext.getEncoding());
176  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attach()

void org.turro.mail.message.MailMessage.attach ( String  path,
String  description,
String  name 
)

Definition at line 85 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

85  {
86  EmailAttachment attachment = new EmailAttachment();
87  attachment.setPath(path);
88  attachment.setDisposition(EmailAttachment.ATTACHMENT);
89  attachment.setDescription(description == null ? "" : description);
90  attachment.setName(name == null ? "" : name);
91  attachments.add(attachment);
92  }
Here is the caller graph for this function:

◆ attachExternal()

void org.turro.mail.message.MailMessage.attachExternal ( URL  url,
String  description,
String  name 
)

Definition at line 94 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

94  {
95  EmailAttachment attachment = new EmailAttachment();
96  attachment.setURL(url);
97  attachment.setDisposition(EmailAttachment.ATTACHMENT);
98  attachment.setDescription(description == null ? "" : description);
99  attachment.setName(name == null ? "" : name);
100  attachments.add(attachment);
101  }

◆ attachRelative()

void org.turro.mail.message.MailMessage.attachRelative ( String  path,
String  description,
String  name 
)

Definition at line 76 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

76  {
77  EmailAttachment attachment = new EmailAttachment();
78  attachment.setPath(ElephantContext.getRealPath(path));
79  attachment.setDisposition(EmailAttachment.ATTACHMENT);
80  attachment.setDescription(description == null ? "" : description);
81  attachment.setName(name == null ? "" : name);
82  attachments.add(attachment);
83  }
Here is the call graph for this function:

◆ embed()

void org.turro.mail.message.MailMessage.embed ( String  name,
File  file 
)

Definition at line 107 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

107  {
108  imageMap.put(name, file);
109  }
Here is the caller graph for this function:

◆ embedExternal()

void org.turro.mail.message.MailMessage.embedExternal ( String  name,
String  url 
) throws MalformedURLException

Definition at line 111 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

111  {
112  imageURLMap.put(name, new URL(url));
113  }

◆ embedRelative()

void org.turro.mail.message.MailMessage.embedRelative ( String  name,
String  path 
)

Definition at line 103 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

103  {
104  embed(name, new File(ElephantContext.getRealPath(path)));
105  }
Here is the call graph for this function:

◆ getEmail()

HtmlEmail org.turro.mail.message.MailMessage.getEmail ( )

Definition at line 52 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

52  {
53  return email;
54  }

◆ getMessage()

String org.turro.mail.message.MailMessage.getMessage ( )

Definition at line 56 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

56  {
57  return message;
58  }
Here is the caller graph for this function:

◆ getProvider()

MailProvider org.turro.mail.message.MailMessage.getProvider ( )

Definition at line 72 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

72  {
73  return provider;
74  }

◆ getSentDate()

Date org.turro.mail.message.MailMessage.getSentDate ( )

Definition at line 150 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

150  {
151  return email.getSentDate();
152  }
Here is the caller graph for this function:

◆ getSubject()

String org.turro.mail.message.MailMessage.getSubject ( )

Definition at line 64 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

64  {
65  return subject;
66  }
Here is the caller graph for this function:

◆ of()

static MailMessage org.turro.mail.message.MailMessage.of ( MailProvider  provider)
static

Reimplemented in org.turro.mail.message.MailMessageTemplate.

Definition at line 213 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send()

void org.turro.mail.message.MailMessage.send ( ) throws EmailException, MalformedURLException, NamingException

Definition at line 115 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

115  {
116  provider.setupMail(email);
117 
118  for(String n : imageMap.keySet()) {
119  String cid = email.embed(imageMap.get(n), n);
120  message = message.replaceAll("image\\(" + n + "\\)", "<img src=\"cid:" + cid + "\"/>");
121  }
122 
123  for(String n : imageURLMap.keySet()) {
124  String cid = email.embed(imageURLMap.get(n), n);
125  message = message.replaceAll("imageURL\\(" + n + "\\)", "<img src=\"cid:" + cid + "\"/>");
126  }
127 
128  email.setSubject(subject);
129 
130  for(EmailAttachment ea : attachments) {
131  email.attach(ea);
132  }
133 
134  String serverBase = ElephantContext.getServerBase("http");
135  message = message.replaceAll("href=\\'(?![a-z]+:)(\\/?)\\/?([^\\']*)\\'", "href=\\'" + serverBase + "$1$2\\'")
136  .replaceAll("src=\\'(?![a-z]+:)(\\/?)\\/?([^\\']*)\\'", "src=\\'" + serverBase + "$1$2\\'")
137  .replaceAll("href=\\\"(?![a-z]+:)(\\/?)\\/?([^\\\"]*)\\\"", "href=\\\"" + serverBase + "$1$2\\\"")
138  .replaceAll("src=\\\"(?![a-z]+:)(\\/?)\\/?([^\\\"]*)\\\"", "src=\\\"" + serverBase + "$1$2\\\"");
139 
140  message = new MailInline().inline(message);
141 
142  email.setHtmlMsg(message);
143  email.setTextMsg("NO HTML SUPPORTED");
144 
145  email.send();
146  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFrom() [1/2]

Email org.turro.mail.message.MailMessage.setFrom ( String  email) throws EmailException

Definition at line 162 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

162  {
163  if(email != null) {
164  if(email.contains("|")) {
165  String[] parts = email.split("\\|");
166  return this.email.setFrom(parts[0], parts[1], ElephantContext.getEncoding());
167  }
168  return this.email.setFrom(email);
169  }
170  return this.email;
171  }
Here is the call graph for this function:

◆ setFrom() [2/2]

Email org.turro.mail.message.MailMessage.setFrom ( String  email,
String  name 
) throws EmailException

Definition at line 158 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

158  {
159  return this.email.setFrom(email, name, ElephantContext.getEncoding());
160  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMessage()

void org.turro.mail.message.MailMessage.setMessage ( String  message)

Definition at line 60 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

60  {
61  this.message = message;
62  }
Here is the caller graph for this function:

◆ setSentDate()

void org.turro.mail.message.MailMessage.setSentDate ( Date  date)

Definition at line 154 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

154  {
155  email.setSentDate(date);
156  }

◆ setSubject()

void org.turro.mail.message.MailMessage.setSubject ( String  subject)

Definition at line 68 of file elephant-mail/src/main/java/org/turro/mail/message/MailMessage.java.

68  {
69  this.subject = subject;
70  }
Here is the caller graph for this function:

Member Data Documentation

◆ provider

final MailProvider org.turro.mail.message.MailMessage.provider
protected

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