|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.turbine.util.mail.Email
org.apache.turbine.util.mail.MultiPartEmail
org.apache.turbine.util.mail.HtmlEmail
An HTML multipart email.
This class is used to send HTML formatted email. A text message can also be set for HTML unaware email clients, such as text-based email clients.
This class also inherits from MultiPartEmail, so it is easy to add attachents to the email.
To send an email in HTML, one should create a HtmlEmail, then use the setFrom, addTo, etc. methods. The HTML content can be set with the setHtmlMsg method. The alternate text content can be set with setTextMsg.
Either the text or HTML can be omitted, in which case the "main" part of the multipart becomes whichever is supplied rather than a multipart/alternative.
Field Summary | |
protected java.lang.String |
html
Deprecated. |
protected javax.mail.internet.MimeMultipart |
htmlContent
Deprecated. |
protected java.lang.String |
text
Deprecated. |
Fields inherited from class org.apache.turbine.util.mail.MultiPartEmail |
emailBody, main |
Fields inherited from class org.apache.turbine.util.mail.Email |
ATTACHMENTS, 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, SENDER_EMAIL, SENDER_NAME, SMTP, TEXT_HTML, TEXT_PLAIN, US_ASCII |
Constructor Summary | |
HtmlEmail()
Deprecated. Basic constructor. |
Method Summary | |
java.lang.String |
embed(java.net.URL url,
java.lang.String name)
Deprecated. Embeds an URL in the HTML. |
javax.mail.internet.MimeMultipart |
getHtmlContent()
Deprecated. Instantiates a new MimeMultipart object if it isn't already instantiated. |
void |
send()
Deprecated. Does the work of actually sending the email. |
HtmlEmail |
setHtmlMsg(org.apache.ecs.Document doc)
Deprecated. Set the HTML content based on an ECS document. |
HtmlEmail |
setHtmlMsg(java.lang.String html)
Deprecated. Set the HTML content. |
Email |
setMsg(java.lang.String msg)
Deprecated. Set the message. |
HtmlEmail |
setTextMsg(java.lang.String text)
Deprecated. Set the text content. |
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, initialize, setCharset, setFrom, setSentDate, setSubject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected javax.mail.internet.MimeMultipart htmlContent
protected java.lang.String text
protected java.lang.String html
Constructor Detail |
public HtmlEmail() throws javax.mail.MessagingException
MessagingException.
javax.mail.MessagingException
Method Detail |
public javax.mail.internet.MimeMultipart getHtmlContent()
public HtmlEmail setTextMsg(java.lang.String text) throws javax.mail.MessagingException
text
- A String.
MessagingException.
javax.mail.MessagingException
public HtmlEmail setHtmlMsg(java.lang.String html) throws javax.mail.MessagingException
html
- A String.
MessagingException.
javax.mail.MessagingException
public HtmlEmail setHtmlMsg(org.apache.ecs.Document doc) throws javax.mail.MessagingException
doc
- A Document.
MessagingException.
javax.mail.MessagingException
public Email setMsg(java.lang.String msg) throws javax.mail.MessagingException
This method overrides the MultiPartEmail setMsg() method in order to send an HTML message instead of a full text message in the mail body. The message is formatted in HTML for the HTML part of the message, it is let as is in the alternate text part.
setMsg
in class MultiPartEmail
msg
- A String.
MessagingException.
javax.mail.MessagingException
public java.lang.String embed(java.net.URL url, java.lang.String name) throws javax.mail.MessagingException
This method allows to embed a file located by an URL into
the mail body. It allows, for instance, to add inline images
to the email. Inline files may be referenced with a
cid:xxxxxx
URL, where xxxxxx is the Content-ID
returned by the embed function.
Example of use:
HtmlEmail he = new HtmlEmail();
he.setHtmlMsg("<html><img src=cid:"+embed("file:/my/image.gif","image.gif")+"></html>");
// code to set the others email fields (not shown)
url
- The URL of the file.name
- The name that will be set in the filename header
field.
MessagingException.
javax.mail.MessagingException
public void send() throws javax.mail.MessagingException
send
in class Email
MessagingException,
- if there was an error.
javax.mail.MessagingException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |