You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jm...@apache.org on 2002/09/18 00:08:22 UTC

cvs commit: jakarta-commons-sandbox/email/src/java/org/apache/commons/mail Email.java

jmcnally    2002/09/17 15:08:21

  Modified:    email/src/java/org/apache/commons/mail Email.java
  Added:       email    STATUS.html
  Log:
  allow the use of an alternate encoding than the system default.
  
  added a status file so i could add my name to it.
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/email/STATUS.html
  
  Index: STATUS.html
  ===================================================================
  <html>
  <head>
  <title>Status File for Jakarta Commons "Email" Component</title>
  </head>
  <body bgcolor="white">
  
  
  <div align="center">
  <h1>The Jakarta Commons <em>Email</em> Component</h1>
  $Id: STATUS.html,v 1.1 2002/09/17 22:08:21 jmcnally Exp $<br />
  <a href="#Introduction">[Introduction]</a>
  <a href="#Dependencies">[Dependencies]</a>
  <a href="#Release Info">[Release Info]</a>
  <a href="#Committers">[Committers]</a>
  <a href="#Action Items">[Action Items]</a>
  <br /><br />
  </div>
  
  
  <a name="Introduction"></a>
  <h3>1.  INTRODUCTION</h3>
  
  <p>The <em>Email</em> Component contains a set of Java classes provide a
  thin convenience layer over JavaMail. 
  
  <a name="Dependencies"></a>
  <h3>2.  DEPENDENCIES</h3>
  
  <p>The <em>Email</em> component is dependent upon the following external
  components for development and use:</p>
  <ul>
  <li><a href="http://java.sun.com/j2se">Java Development Kit</a>
      (Version 1.2 or later)</li>
  <li><a href="http://java.sun.com/products/javamail/">
      JavaMail</a> . (Version 1.2 or later)</li>
  <li><a href="http://java.sun.com/products/javabeans/glasgow/jaf.html">
      JavaBeans Activation Framework</a> (Version 1.0.1 or later) 
       - dependency of JavaMail.</li>
  <li>commons-util has an id generator used in HtmlEmail</li>
  <!-- <li><a href="http://www.junit.org">JUnit Testing Framework</a>
      (Version 3.7 or later) - for unit tests only, not required
      for deployment</li> -->
  </ul>
  
  
  <a name="Release Info"></a>
  <h3>3.  RELEASE INFO</h3>
  
  <p>Current Release: Email is yet to be released.</p>
  
  <p>Planned Next Release:  The components are relatively mature and from 
  Turbine, however time will be given for the Email package to achieve 
  some stability, and unit-tests to arrive.</p>
  
  
  <a name="Committers"></a>
  <h3>4.  COMMITTERS</h3>
  
  <p>The following individuals are the primary developers and maintainers of this
  component.  Developers who plan to use <em>Email</em> in their own
  projects are encouraged to collaborate on the future development of this
  component to ensure that it continues to meet a variety of needs.</p>
  <ul>
  <li><a href="mailto:jmcnally at apache.org">John McNally</a></li>
  <li><a href="mailto:jon at apache.org">Jon Stevens</a></li>
  </ul>
  
  </body>
  </html>
  
  
  
  1.3       +32 -7     jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/Email.java
  
  Index: Email.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/Email.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Email.java	7 Sep 2001 17:23:42 -0000	1.2
  +++ Email.java	17 Sep 2002 22:08:21 -0000	1.3
  @@ -193,7 +193,23 @@
       public void setContent(Object aObject, String aContentType)
       {
           this.content = aObject;
  -        this.contentType = aContentType;
  +        if (aContentType == null) 
  +        {
  +            this.contentType = aContentType;
  +        }
  +        else 
  +        {        
  +            int charsetPos = aContentType.toLowerCase().indexOf("; charset=");
  +            if (charsetPos > 0) 
  +            {
  +                aContentType.substring(0, charsetPos);
  +                charset = aContentType.substring(charsetPos + 10);
  +            }
  +            else 
  +            {
  +                this.contentType = aContentType;
  +            }
  +        }
       }
   
       /**
  @@ -499,17 +515,26 @@
       {
           MimeMessage message = new MimeMessage(getMailSession());
   
  -        // Set the sent date.
  -        message.setSentDate(new Date());
  -
           if (subject != null)
           {
  -            message.setSubject(subject);
  +            if (charset == null) 
  +            {
  +                message.setSubject(subject);
  +            }
  +            else 
  +            {
  +                message.setSubject(subject, charset);
  +            }
           }
   
           if (content != null)
           {
  -            message.setContent(content, contentType);
  +            String type = contentType;
  +            if (type != null && charset != null) 
  +            {
  +                type += "; charset=" + charset;
  +            } 
  +            message.setContent(content, type);
           }
           else if (emailBody != null)
           {
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>