jon 01/06/27 13:27:59
Modified: src/java/org/apache/turbine/util/mail HtmlEmail.java
Log:
a not so minimal patch that should fix the problem properly
closes bugid 2301
Revision Changes Path
1.11 +21 -7
jakarta-turbine/src/java/org/apache/turbine/util/mail/HtmlEmail.java
Index: HtmlEmail.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/mail/HtmlEmail.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- HtmlEmail.java 2001/05/06 17:06:45 1.10
+++ HtmlEmail.java 2001/06/27 20:27:57 1.11
@@ -67,9 +67,7 @@
import javax.mail.internet.MimeMultipart;
import org.apache.ecs.Document;
-import org.apache.ecs.Element;
import org.apache.ecs.ElementContainer;
-import org.apache.ecs.GenericElement;
import org.apache.ecs.html.Body;
import org.apache.ecs.html.Html;
import org.apache.ecs.html.PRE;
@@ -98,7 +96,7 @@
*
* @author <a href="mailto:unknown">Regis Koenig</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sean Legassick</a>
- * @version $Id: HtmlEmail.java,v 1.10 2001/05/06 17:06:45 jvanzyl Exp $
+ * @version $Id: HtmlEmail.java,v 1.11 2001/06/27 20:27:57 jon Exp $
*/
public class HtmlEmail
extends MultiPartEmail
@@ -120,6 +118,21 @@
}
/**
+ * Instantiates a new MimeMultipart object if it isn't already
+ * instantiated.
+ *
+ * @return A MimeMultipart object
+ */
+ public MimeMultipart getHtmlContent()
+ {
+ if (htmlContent == null)
+ {
+ htmlContent = new MimeMultipart();
+ }
+ return htmlContent;
+ }
+
+ /**
* Set the text content.
*
* @param text A String.
@@ -150,11 +163,11 @@
/**
* Set the HTML content based on an ECS document.
*
- * @param doc An org.apache.ecs.Document.
+ * @param doc A Document.
* @return An HtmlEmail.
* @exception MessagingException.
*/
- public HtmlEmail setHtmlMsg(org.apache.ecs.Document doc)
+ public HtmlEmail setHtmlMsg(Document doc)
throws MessagingException
{
return setHtmlMsg(doc.toString());
@@ -207,13 +220,14 @@
throws MessagingException
{
MimeBodyPart mbp = new MimeBodyPart();
- htmlContent.addBodyPart( mbp );
mbp.setDataHandler ( new DataHandler( new URLDataSource(url) ) );
mbp.setFileName( name );
mbp.setDisposition("inline");
String cid = org.apache.turbine.util.GenerateUniqueId.getIdentifier();
mbp.addHeader("Content-ID", cid);
+
+ getHtmlContent().addBodyPart( mbp );
return mbp.getContentID();
}
@@ -231,7 +245,7 @@
if (StringUtils.isValid(text) && StringUtils.isValid(html))
{
// The message in text and HTML form.
- MimeMultipart msg = new MimeMultipart();
+ MimeMultipart msg = getHtmlContent();
msg.setSubType("alternative");
main.setContent(msg);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]