Java Doc for HtmlEmail.java in  » Net » apache-common-Email » org » apache » commons » mail » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » apache common Email » org.apache.commons.mail 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.mail.Email
      org.apache.commons.mail.MultiPartEmail
         org.apache.commons.mail.HtmlEmail

All known Subclasses:   org.apache.commons.mail.mocks.MockHtmlEmailConcrete,
HtmlEmail
public class HtmlEmail extends MultiPartEmail (Code)
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 attachments 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 alternative 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.
since:
   1.0
author:
   Regis Koenig
author:
   Sean Legassick
version:
   $Id: HtmlEmail.java 279285 2005-09-07 09:52:44Z henning $



Field Summary
final public static  intCID_LENGTH
    
protected  Stringhtml
    
protected  ListinlineImages
    
protected  Stringtext
     Text part of the message.


Method Summary
public  voidbuildMimeMessage()
     Does the work of actually building the email.
public  Stringembed(URL url, String name)
     Embeds an URL in the HTML.

This method allows to embed a file located by an URL into the mail body.

public  HtmlEmailsetHtmlMsg(String aHtml)
     Set the HTML content.
Parameters:
  aHtml - A String.
public  EmailsetMsg(String msg)
     Set the message.

This method overrides the MultiPartEmail setMsg() method in order to send an HTML message instead of a full text message in the mail body.

public  HtmlEmailsetTextMsg(String aText)
     Set the text content.
Parameters:
  aText - A String.

Field Detail
CID_LENGTH
final public static int CID_LENGTH(Code)
Definition of the length of generated CID's



html
protected String html(Code)
Html part of the message



inlineImages
protected List inlineImages(Code)
Embedded images



text
protected String text(Code)
Text part of the message. This will be used as alternative text if the email client does not support HTML messages.





Method Detail
buildMimeMessage
public void buildMimeMessage() throws EmailException(Code)
Does the work of actually building the email.
exception:
  EmailException - if there was an error.
since:
   1.0



embed
public String embed(URL url, String name) throws EmailException(Code)
Embeds an URL in the HTML.

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)
 

Parameters:
  url - The URL of the file.
Parameters:
  name - The name that will be set in the filename headerfield. A String with the Content-ID of the file.
throws:
  EmailException - when URL supplied is invalidalso see javax.mail.internet.MimeBodyPart for definitions
since:
   1.0



setHtmlMsg
public HtmlEmail setHtmlMsg(String aHtml) throws EmailException(Code)
Set the HTML content.
Parameters:
  aHtml - A String. An HtmlEmail.
throws:
  EmailException - see javax.mail.internet.MimeBodyPartfor definitions
since:
   1.0



setMsg
public Email setMsg(String msg) throws EmailException(Code)
Set the message.

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.
Parameters:
  msg - A String. An Email.
throws:
  EmailException - see javax.mail.internet.MimeBodyPartfor definitions
since:
   1.0




setTextMsg
public HtmlEmail setTextMsg(String aText) throws EmailException(Code)
Set the text content.
Parameters:
  aText - A String. An HtmlEmail.
throws:
  EmailException - see javax.mail.internet.MimeBodyPartfor definitions
since:
   1.0



Methods inherited from org.apache.commons.mail.MultiPartEmail
public Email addPart(String partContent, String partContentType) throws EmailException(Code)(Java Doc)
public Email addPart(MimeMultipart multipart) throws EmailException(Code)(Java Doc)
public Email addPart(MimeMultipart multipart, int index) throws EmailException(Code)(Java Doc)
public MultiPartEmail attach(EmailAttachment attachment) throws EmailException(Code)(Java Doc)
public MultiPartEmail attach(URL url, String name, String description) throws EmailException(Code)(Java Doc)
public MultiPartEmail attach(URL url, String name, String description, String disposition) throws EmailException(Code)(Java Doc)
public MultiPartEmail attach(DataSource ds, String name, String description) throws EmailException(Code)(Java Doc)
public MultiPartEmail attach(DataSource ds, String name, String description, String disposition) throws EmailException(Code)(Java Doc)
public void buildMimeMessage() throws EmailException(Code)(Java Doc)
protected BodyPart createBodyPart()(Code)(Java Doc)
protected MimeMultipart createMimeMultipart()(Code)(Java Doc)
protected MimeMultipart getContainer()(Code)(Java Doc)
protected BodyPart getPrimaryBodyPart() throws MessagingException(Code)(Java Doc)
public String getSubType()(Code)(Java Doc)
protected void init()(Code)(Java Doc)
public boolean isBoolHasAttachments()(Code)(Java Doc)
protected boolean isInitialized()(Code)(Java Doc)
public void setBoolHasAttachments(boolean b)(Code)(Java Doc)
protected void setInitialized(boolean b)(Code)(Java Doc)
public Email setMsg(String msg) throws EmailException(Code)(Java Doc)
public void setSubType(String aSubType)(Code)(Java Doc)

Fields inherited from org.apache.commons.mail.Email
final public static String ATTACHMENTS(Code)(Java Doc)
final public static String CONTENT_TYPE(Code)(Java Doc)
final public static String EMAIL_BODY(Code)(Java Doc)
final public static String EMAIL_SUBJECT(Code)(Java Doc)
final public static String FILE_SERVER(Code)(Java Doc)
final public static String ISO_8859_1(Code)(Java Doc)
final public static String KOI8_R(Code)(Java Doc)
final public static String MAIL_DEBUG(Code)(Java Doc)
final public static String MAIL_HOST(Code)(Java Doc)
final public static String MAIL_PORT(Code)(Java Doc)
final public static String MAIL_SMTP_AUTH(Code)(Java Doc)
final public static String MAIL_SMTP_FROM(Code)(Java Doc)
final public static String MAIL_TRANSPORT_PROTOCOL(Code)(Java Doc)
final public static String RECEIVER_EMAIL(Code)(Java Doc)
final public static String RECEIVER_NAME(Code)(Java Doc)
final public static String SENDER_EMAIL(Code)(Java Doc)
final public static String SENDER_NAME(Code)(Java Doc)
final public static String SMTP(Code)(Java Doc)
final public static String TEXT_HTML(Code)(Java Doc)
final public static String TEXT_PLAIN(Code)(Java Doc)
final public static String US_ASCII(Code)(Java Doc)
protected Authenticator authenticator(Code)(Java Doc)
protected List bccList(Code)(Java Doc)
protected String bounceAddress(Code)(Java Doc)
protected List ccList(Code)(Java Doc)
protected String charset(Code)(Java Doc)
protected Object content(Code)(Java Doc)
protected String contentType(Code)(Java Doc)
protected boolean debug(Code)(Java Doc)
protected MimeMultipart emailBody(Code)(Java Doc)
protected InternetAddress fromAddress(Code)(Java Doc)
protected Map headers(Code)(Java Doc)
protected String hostName(Code)(Java Doc)
protected MimeMessage message(Code)(Java Doc)
protected boolean popBeforeSmtp(Code)(Java Doc)
protected String popHost(Code)(Java Doc)
protected String popPassword(Code)(Java Doc)
protected String popUsername(Code)(Java Doc)
protected List replyList(Code)(Java Doc)
protected Date sentDate(Code)(Java Doc)
protected String smtpPort(Code)(Java Doc)
protected String subject(Code)(Java Doc)
protected List toList(Code)(Java Doc)

Methods inherited from org.apache.commons.mail.Email
public Email addBcc(String email) throws EmailException(Code)(Java Doc)
public Email addBcc(String email, String name) throws EmailException(Code)(Java Doc)
public Email addCc(String email) throws EmailException(Code)(Java Doc)
public Email addCc(String email, String name) throws EmailException(Code)(Java Doc)
public void addHeader(String name, String value)(Code)(Java Doc)
public Email addReplyTo(String email) throws EmailException(Code)(Java Doc)
public Email addReplyTo(String email, String name) throws EmailException(Code)(Java Doc)
public Email addTo(String email) throws EmailException(Code)(Java Doc)
public Email addTo(String email, String name) throws EmailException(Code)(Java Doc)
public void buildMimeMessage() throws EmailException(Code)(Java Doc)
public InternetAddress getFromAddress()(Code)(Java Doc)
public String getHostName()(Code)(Java Doc)
public Session getMailSession() throws EmailException(Code)(Java Doc)
public MimeMessage getMimeMessage()(Code)(Java Doc)
public Date getSentDate()(Code)(Java Doc)
public String getSmtpPort()(Code)(Java Doc)
public String getSubject()(Code)(Java Doc)
public String send() throws EmailException(Code)(Java Doc)
public String sendMimeMessage() throws EmailException(Code)(Java Doc)
public void setAuthentication(String userName, String password)(Code)(Java Doc)
public void setAuthenticator(Authenticator newAuthenticator)(Code)(Java Doc)
public Email setBcc(Collection aCollection) throws EmailException(Code)(Java Doc)
public Email setBounceAddress(String email)(Code)(Java Doc)
public Email setCc(Collection aCollection) throws EmailException(Code)(Java Doc)
public void setCharset(String newCharset)(Code)(Java Doc)
public void setContent(MimeMultipart aMimeMultipart)(Code)(Java Doc)
public void setContent(Object aObject, String aContentType)(Code)(Java Doc)
public void setDebug(boolean d)(Code)(Java Doc)
public Email setFrom(String email) throws EmailException(Code)(Java Doc)
public Email setFrom(String email, String name) throws EmailException(Code)(Java Doc)
public void setHeaders(Map map)(Code)(Java Doc)
public void setHostName(String aHostName)(Code)(Java Doc)
public void setMailSession(Session aSession)(Code)(Java Doc)
abstract public Email setMsg(String msg) throws EmailException(Code)(Java Doc)
public void setPopBeforeSmtp(boolean newPopBeforeSmtp, String newPopHost, String newPopUsername, String newPopPassword)(Code)(Java Doc)
public void setSentDate(Date date)(Code)(Java Doc)
public void setSmtpPort(int aPortNumber)(Code)(Java Doc)
public Email setSubject(String aSubject)(Code)(Java Doc)
public Email setTo(Collection aCollection) throws EmailException(Code)(Java Doc)
protected InternetAddress[] toInternetAddressArray(List list)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.