|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.turbine.util.mail.Email | +--org.apache.turbine.util.mail.MultiPartEmail | +--org.apache.turbine.util.mail.HtmlEmail | +--org.apache.turbine.util.webmacro.WebMacroHtmlEmail
This is a simple class for sending html email from within WebMacro. Essentially, the bodies (text and html) of the email are a WebMacro Context objects. The beauty of this is that you can send email from within your WebMacro template or from your business logic in your Java code. The body of the email is just a WebMacro template so you can use all the template functionality of WebMacro within your emails!
This class allows you to send HTML email with embedded content
and/or with attachments. You can access the WebMacroHtmlEmail
instance within your templates trough the $mail
WebMacro variable.
The templates should be located under your Template turbine directory.
This class extends the HtmlEmail class. Thus, it uses the JavaMail API and also depends on having the mail.server property set in the TurbineResources.properties file. If you want to use this class outside of Turbine for general processing that is also possible by making sure to set the path to the TurbineResources.properties. See the TurbineConfig class for more information.
Field Summary | |
private org.webmacro.servlet.WebContext |
context
Deprecated. A WebContext |
private java.util.Hashtable |
embmap
Deprecated. The map of embedded files. |
private java.lang.String |
htmlTemplate
Deprecated. The html template to process, relative to WM's template directory. |
private java.lang.String |
textTemplate
Deprecated. The text template to process, relative to WM's template directory. |
Fields inherited from class org.apache.turbine.util.mail.HtmlEmail |
html, htmlContent, text |
Fields inherited from class org.apache.turbine.util.mail.MultiPartEmail |
emailBody, fileServer, main |
Fields inherited from class org.apache.turbine.util.mail.Email |
ATTACHMENTS, bccList, ccList, charset, CONTENT_TYPE, EMAIL_BODY, EMAIL_SUBJECT, FILE_SERVER, ISO_8859_1, KOI8_R, MAIL_HOST, MAIL_SERVER, MAIL_SMTP_FROM, MAIL_TRANSPORT_PROTOCOL, message, RECEIVER_EMAIL, RECEIVER_NAME, replyList, SENDER_EMAIL, SENDER_NAME, SMTP, TEXT_HTML, TEXT_PLAIN, toList, US_ASCII |
Constructor Summary | |
WebMacroHtmlEmail()
Deprecated. Constructor, sets the RunData object. |
Method Summary | |
java.lang.String |
embed(java.lang.String surl,
java.lang.String name)
Deprecated. Embed a file in the mail. |
java.lang.String |
getCid(java.lang.String filename)
Deprecated. Get the cid of an embedded file. |
org.webmacro.servlet.WebContext |
getContext()
Deprecated. Get the context object that will be merged with the template. |
void |
send()
Deprecated. Actually send the mail. |
WebMacroHtmlEmail |
setContext(org.webmacro.servlet.WebContext context)
Deprecated. Set the context object that will be merged with the template. |
WebMacroHtmlEmail |
setHtmlTemplate(java.lang.String template)
Deprecated. Set the HTML template for the mail. |
WebMacroHtmlEmail |
setTextTemplate(java.lang.String template)
Deprecated. Set the text template for the mail. |
Methods inherited from class org.apache.turbine.util.mail.HtmlEmail |
embed, getHtmlContent, setHtmlMsg, setHtmlMsg, setMsg, setTextMsg |
Methods inherited from class org.apache.turbine.util.mail.MultiPartEmail |
attach, attach, attach, attach, attach, init, initCriteria |
Methods inherited from class org.apache.turbine.util.mail.Email |
addBcc, addCc, addReplyTo, addTo, getMailSession, initialize, setCharset, setFrom, setSentDate, setSubject, toInternetAddressArray |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.lang.String htmlTemplate
private java.lang.String textTemplate
private java.util.Hashtable embmap
private org.webmacro.servlet.WebContext context
Constructor Detail |
public WebMacroHtmlEmail() throws javax.mail.MessagingException
data
- A Turbine RunData object.MessagingException.
- Method Detail |
public WebMacroHtmlEmail setHtmlTemplate(java.lang.String template)
template
- A String.public WebMacroHtmlEmail setTextTemplate(java.lang.String template)
template
- A String.public WebMacroHtmlEmail setContext(org.webmacro.servlet.WebContext context)
context
- A WebMacro context object.public org.webmacro.servlet.WebContext getContext()
public void send() throws javax.mail.MessagingException
send
in class HtmlEmail
MessagingException.
- public java.lang.String embed(java.lang.String surl, java.lang.String name) throws javax.mail.MessagingException
Example of template:
<html>
<!-- $mail.embed("http://server/border.gif","border.gif"); -->
<img src=$mail.getCid("border.gif")>
<p>This is your content
<img src=$mail.getCid("border.gif")>
</html>
surl
- A String.name
- A String.MessagingException.
- embed.
public java.lang.String getCid(java.lang.String filename)
filename
- A String.embed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |