Should be okay now.
There are 2 new files that I did not manage to add to the diff (I don't
know how to do).

HtmlEmail.java and WebMacroHtmlEmail.java are available at

http://www.chez.com/rkoenig/turbine

Regis


-- CUT --

Index: mail/Email.java
===================================================================
RCS file:
/products/cvs/turbine/turbine/src/java/org/apache/turbine/util/mail/Email.java,v
retrieving revision 1.6
diff -r1.6 Email.java
81a82
>  * @author Regis Koenig
83c84,85
< public abstract class Email {
---
> public abstract class Email
> {
91d92
<     public static final String ATTACHMENTS = "attachments";
93d93
<     public static final String FILE_SERVER = "file.server";
99a100,305
>     public static final String ATTACHMENTS = "attachments";
>     public static final String FILE_SERVER = "file.server";
>     
>     /** The email message to send.
>      */
>     Message message;
> 
>     /* Lists of related email adresses */
>     private Vector toList;
>     private Vector ccList;
>     private Vector bccList;
>     private Vector replyList;
> 
>     private Session getMailSession()
>     {
>         Properties properties = System.getProperties();
>         properties.put ( MAIL_TRANSPORT_PROTOCOL, SMTP );
>         properties.put ( MAIL_HOST, TurbineResources.getString( MAIL_SERVER ) );
>         return Session.getDefaultInstance(properties, null);
>     }
> 
>     
> 
>     /** Initializes the mail.
>      * @deprecated
>      * @see init()
>      */
>     protected void initialize(Criteria criteria)
>         throws MessagingException
>     {
>         init();
>         initCriteria(criteria);
>     }
>     
>     /** Initializes the mail.
>      * <p> This is the first method that should be called by
>      * a sublasse in its constructor;
>      */
>     protected void init()
>         throws MessagingException
>     {
>     
>         // create the message
>         message = new MimeMessage( getMailSession() );
>     
>         toList = new Vector();
>         ccList = new Vector();
>         bccList = new Vector();
>         replyList = new Vector();
> 
>         // set the sent date
>         setSentDate( new Date() );
>     }
> 
>     /** Initialize the mail according to the Criteria
>      * <p>This method uses the criteria parameter to set
>      * the from, to and subject field of the email
>      *
>      * @deprecated One should use the setFrom, addTo, etc. methods
>      */
>     protected void initCriteria( Criteria criteria )
>         throws MessagingException
>     {
>     
>         // set the FROM field
>         if( criteria.containsKey( SENDER_EMAIL) && criteria.containsKey( SENDER_NAME 
>) )
>             setFrom(criteria.getString( SENDER_EMAIL ), criteria.getString( 
>SENDER_NAME ));
>         // set the TO field
>         if( criteria.containsKey( RECEIVER_EMAIL) && criteria.containsKey( 
>RECEIVER_NAME ) )
>             addTo( criteria.getString( RECEIVER_EMAIL ), criteria.getString( 
>RECEIVER_NAME ) );
>         // set the SUBJECT field
>         if( criteria.containsKey( EMAIL_SUBJECT ) )
>             setSubject( criteria.getString( EMAIL_SUBJECT ) );
>     }
> 
>     /** Set the FROM field of the email
>      */
>     public Email setFrom(String email, String name )
>         throws MessagingException
>     {
> 
>         try          
>         {
>             if( (name == null) || (name.trim().equals("")) )
>             {
>                 name = email;
>             }
>             message.setFrom(new InternetAddress( email, name ) );
>         }
>         catch( Exception e )
>         {
>             throw new MessagingException("cannot set from", e);
>         }
>         return this;
>     }
> 
> 
>     /** Add a recipient TO to the email
>      */
>     public Email addTo(String email, String name )
>         throws MessagingException
>     {
> 
>         try
>         {
>             if( (name == null) || (name.trim().equals("")) )
>             {
>                 name = email;
>             }
>             toList.add( new InternetAddress( email, name ) );
>         }
>         catch( Exception e )
>         {
>             throw new MessagingException("cannot add to", e);
>         }
>         return this;
>     }
> 
>     /** Add a recipient CC to the email
>      */
>     public Email addCc(String email, String name )
>         throws MessagingException
>     {
> 
>         try
>         {
>             if( (name == null) || (name.trim().equals("")) )
>             {
>                 name = email;
>             }
>             ccList.add( new InternetAddress( email, name ) );
>         }
>         catch( Exception e )
>         {
>             throw new MessagingException("cannot add cc", e);
>         }
> 
>         return this;
>     }
> 
>     /** Add a blind CC repcipient to the email
>      */
>     public Email addBcc(String email, String name )
>         throws MessagingException
>     {
> 
>         try
>         {
>             if( (name == null) || (name.trim().equals("")) )
>             {
>                 name = email;
>             }
>             bccList.add( new InternetAddress( email, name ) );
>         }
>         catch( Exception e )
>         {
>             throw new MessagingException("cannot add bcc", e);
>         }
> 
>         return this;
>     }
> 
>     /** Add a reply to address to the email
>      */
>     public Email addReplyTo(String email, String name )
>         throws MessagingException
>     {
> 
>         try
>         {
>             if( (name == null) || (name.trim().equals("")) )
>             {
>                 name = email;
>             }
>             replyList.add( new InternetAddress( email, name ) );
>         }
>         catch( Exception e )
>         {
>             throw new MessagingException("cannot add replyTo", e);
>         }
>         return this;
>     }
> 
>     /** Set the email subject
>      */
>     public Email setSubject( String subject )
>         throws MessagingException
>     {
>         message.setSubject(subject);
>         return this;
>     }
> 
>     /** Set the sent date field
>      */
>     public Email setSentDate( Date date )
>         throws MessagingException
>     {
>         message.setSentDate( date );
>         return this;
>     }
> 
>     /** Define the content of the mail
>      * <p>should be overidden by the sublcasses
>      */
>     public abstract Email setMsg(String msg)
>         throws MessagingException;
101,137c307,324
<       /** The email message to send. */
<       Message message;
<       
<       private Session getMailSession()
<       {
<               Properties properties = System.getProperties();
<               properties.put ( MAIL_TRANSPORT_PROTOCOL, SMTP );
<               properties.put ( MAIL_HOST, TurbineResources.getString( MAIL_SERVER
) );
<               return Session.getDefaultInstance(properties, null);
<       }
<       protected void initialize( Criteria criteria ) throws Exception
<       {
<               // create the message
<               message = new MimeMessage( getMailSession() );
< 
<               // set the FROM field
<               message.setFrom( new InternetAddress( criteria.getString(
SENDER_EMAIL ),
<                                                                                      
   criteria.getString( SENDER_NAME ) ) );
<               // set the TO field
<               message.setRecipient( Message.RecipientType.TO, 
<                                                         new InternetAddress( 
criteria.getString( RECEIVER_EMAIL ),
<                                                                                      
            criteria.getString( RECEIVER_NAME ) ) );
<               // set the SUBJECT field
<               message.setSubject( criteria.getString( EMAIL_SUBJECT ) );
<               
<               // set the sent date
<               message.setSentDate( new Date() );
<       }
<       /**
<        * Does the work of actually sending the email.
<        *
<        * @exception MessagingException if an error
<        */
<       public void     send() throws MessagingException
<       {
<               Transport.send( message );
<       }
---
>     /**
>      * Does the work of actually sending the email.
>      *
>      * @exception MessagingException if an error
>      */
>     public void send()
>         throws MessagingException
>     {
>         InternetAddress[] foo = new InternetAddress[0];
>         message.setRecipients(Message.RecipientType.TO,
>                               (InternetAddress[])toList.toArray(foo));
>         message.setRecipients(Message.RecipientType.CC,
>                               (InternetAddress[])ccList.toArray(foo));
>         message.setRecipients(Message.RecipientType.BCC,
>                               (InternetAddress[])bccList.toArray(foo));
>         message.setReplyTo((InternetAddress[])replyList.toArray(foo));
>         Transport.send( message );
>     }
Index: mail/EmailAttachment.java
===================================================================
RCS file:
/products/cvs/turbine/turbine/src/java/org/apache/turbine/util/mail/EmailAttachment.java,v
retrieving revision 1.1
diff -r1.1 EmailAttachment.java
56a57,58
> 
> import java.net.URL;
64a67,69
>     public final static String ATTACHMENT = javax.mail.Part.ATTACHMENT;
>     public final static String INLINE = javax.mail.Part.INLINE;
>     
70a76,79
>     /** The HttpURI where the file can be got */
>     private URL url = null;
>     /** The disposition */
>     private String disposition = ATTACHMENT;
83a93,100
>     public URL getURL()
>     {
>         return url;
>     }
>     public String getDisposition()
>     {
>         return disposition;
>     }
96c113,121
< }
\ No newline at end of file
---
>     public void setURL(URL url)
>     {
>         this.url = url;
>     }
>     public void setDisposition(String disposition)
>     {
>         this.disposition = disposition;
>     }
> }
Index: mail/MailMessage.java
===================================================================
RCS file:
/products/cvs/turbine/turbine/src/java/org/apache/turbine/util/mail/MailMessage.java,v
retrieving revision 1.2
diff -r1.2 MailMessage.java
1d0
< 
70,71c69,70
< /**
<  * MailMessage creates a very simple text/plain message and sends
it.<br>
---
> /** Creates a very simple text/plain message and sends it.
>  * <p>MailMessage creates a very simple text/plain message and sends it.<br>
79c78
<  *<br>
---
>  * <br>
93c92
<  *<br>
---
>  * <br>
97c96,97
< public class MailMessage {
---
> public class MailMessage
> {
151c151
<       
---
>     
158c158,159
<     public MailMessage() {
---
>     public MailMessage()
>     {
161c162
<       
---
>     
166c167,168
<     public MailMessage(String h, String t, String f, String s, String
b) {
---
>     public MailMessage(String h, String t, String f, String s, String b)
>     {
169c171
<       
---
>     
175c177,178
<                        String f, String s, String b, boolean d) {
---
>                        String f, String s, String b, boolean d)
>     {
185,187c188,190
<       
<       /**
<        * Adds a header (name, value) to the headers Hashtable. 
---
>     
>     /**
>      * Adds a header (name, value) to the headers Hashtable. 
189,190c192,195
<     public void addHeader(String name, String value) {
<         if (headers == null) {
---
>     public void addHeader(String name, String value)
>     {
>         if (headers == null)
>         {
195,197c200,202
<       
<     public static InternetAddress[] parseAddressField(String str) {
< 
---
>     
>     public static InternetAddress[] parseAddressField(String str)
>     {
199c204,205
<         if (str.indexOf(",") != -1) {
---
>         if (str.indexOf(",") != -1)
>         {
202c208,209
<             while( st.hasMoreTokens() ) {
---
>             while (st.hasMoreTokens())
>             {
206c213,214
<             for (int i = 0; i < v.size(); i++) {
---
>             for (int i = 0; i < v.size(); i++)
>             {
209c217,219
<         } else {
---
>         }
>         else
>         {
215,216c225,227
<       
<     public static InternetAddress[] parseAddressList(String[]
addressList) {
---
>     
>     public static InternetAddress[] parseAddressList(String[] addressList)
>     {
220c231,232
<         for (int i = 0; i < addressList.length; i++) {
---
>         for (int i = 0; i < addressList.length; i++)
>         {
227,229c239,241
<       
<     public static void parseHeader(String str, Hashtable headers) {
< 
---
>     
>     public static void parseHeader(String str, Hashtable headers)
>     {
240,242c252,254
<       
<     public static Hashtable parseHeaderField(String str) {
< 
---
>     
>     public static Hashtable parseHeaderField(String str)
>     {
244c256,257
<         if (str.indexOf(",") != -1) {
---
>         if (str.indexOf(",") != -1)
>         {
247c260,261
<             while( st.hasMoreTokens() ) {
---
>             while( st.hasMoreTokens() )
>             {
251c265,266
<             for (int i = 0; i < v.size(); i++) {
---
>             for (int i = 0; i < v.size(); i++)
>             {
254c269,271
<         } else {
---
>         }
>         else
>         {
260,262c277,279
<       
<     public static Hashtable parseHeaderList(String[] headerList) {
< 
---
>     
>     public static Hashtable parseHeaderList(String[] headerList)
>     {
265c282,283
<         for (int i = 0; i < headerList.length; i++) {
---
>         for (int i = 0; i < headerList.length; i++)
>         {
269c287
< 
---
>         
272,274c290,292
<       
<     public static InternetAddress parseInternetAddress(String str) {
< 
---
>     
>     public static InternetAddress parseInternetAddress(String str)
>     {
279c297,298
<         if (str.indexOf(" ") == -1) {
---
>         if (str.indexOf(" ") == -1)
>         {
281c300,302
<         } else {
---
>         }
>         else
>         {
288,290c309,311
<       
<     public static InternetAddress parseInternetAddress(String address,
String personal) {
< 
---
>     
>     public static InternetAddress parseInternetAddress(String address, String 
>personal)
>     {
292c313,314
<         try {
---
>         try
>         {
294,295c316,318
< 
<             if (personal != null) {
---
>             
>             if (personal != null)
>             {
298c321,323
<         } catch (AddressException e) {
---
>         }
>         catch (AddressException e)
>         {
302c327,328
<         catch (UnsupportedEncodingException e) {
---
>         catch (UnsupportedEncodingException e)
>         {
309c335
<       
---
>     
314c340,341
<     public boolean send() {
---
>     public boolean send()
>     {
318c345
< 
---
>         
322c349,350
<         try {
---
>         try
>         {
325c353
< 
---
>             
328c356
< 
---
>             
331c359
< 
---
>             
333c361,362
<             if (cc != null) {
---
>             if (cc != null)
>             {
338c367,368
<             if (bcc != null) {
---
>             if (bcc != null)
>             {
341c371
< 
---
>             
343c373,374
<             if (replyTo != null) {
---
>             if (replyTo != null)
>             {
355,356c386,388
< 
<             if (headers != null) {
---
>             
>             if (headers != null)
>             {
358c390,391
<                 while (e.hasMoreElements()) {
---
>                 while (e.hasMoreElements())
>                 {
367c400,402
<         } catch (MessagingException mex) {
---
>         }
>         catch (MessagingException mex)
>         {
370c405,406
<             if ((ex = mex.getNextException()) != null) {
---
>             if ((ex = mex.getNextException()) != null)
>             {
377c413
<       
---
>     
382c418,419
<     public void setBcc(InternetAddress[] bc) {
---
>     public void setBcc(InternetAddress[] bc)
>     {
385c422
<       
---
>     
390c427,428
<     public void setBcc(String bc) {
---
>     public void setBcc(String bc)
>     {
393c431
<       
---
>     
397c435,436
<     public void setBody(String b) {
---
>     public void setBody(String b)
>     {
400c439
<       
---
>     
404c443,444
<     public void setCc(InternetAddress[] c) {
---
>     public void setCc(InternetAddress[] c)
>     {
407c447
<       
---
>     
411c451,452
<     public void setCc(String c) {
---
>     public void setCc(String c)
>     {
414c455
<       
---
>     
418,420c459,462
<     public void setDebug(String str) {
< 
<         if (str.equals("1")) {
---
>     public void setDebug(String str)
>     {
>         if (str.equals("1"))
>         {
422c464,466
<         } else if (str.equals("0")) {
---
>         }
>         else if (str.equals("0"))
>         {
424c468,470
<         } else {
---
>         }
>         else
>         {
428c474
<       
---
>     
432c478,479
<     public void setDebug(boolean d) {
---
>     public void setDebug(boolean d)
>     {
435c482
<       
---
>     
439c486,487
<     public void setFrom(String f) {
---
>     public void setFrom(String f)
>     {
442c490
<       
---
>     
446c494,495
<     public void setFrom(InternetAddress f) {
---
>     public void setFrom(InternetAddress f)
>     {
449c498
<       
---
>     
456c505,506
<     public void setHeaders(String h) {
---
>     public void setHeaders(String h)
>     {
459c509
<       
---
>     
466c516,517
<     public void setHeaders(Hashtable h) {
---
>     public void setHeaders(Hashtable h)
>     {
469c520
<       
---
>     
473c524,525
<     public void setHost(String h) {
---
>     public void setHost(String h)
>     {
476c528
<       
---
>     
480c532,533
<     public void setReplyTo(InternetAddress[] rt) {
---
>     public void setReplyTo(InternetAddress[] rt)
>     {
483c536
<       
---
>     
487c540,541
<     public void setReplyTo(String rp) {
---
>     public void setReplyTo(String rp)
>     {
490c544
<       
---
>     
494c548,549
<     public void setSubject(String s) {
---
>     public void setSubject(String s)
>     {
497c552
<       
---
>     
501c556,557
<     public void setTo(InternetAddress[] t) {
---
>     public void setTo(InternetAddress[] t)
>     {
504c560
<       
---
>     
508c564,565
<     public void setTo(String t) {
---
>     public void setTo(String t)
>     {
Index: mail/MultiPartEmail.java
===================================================================
RCS file:
/products/cvs/turbine/turbine/src/java/org/apache/turbine/util/mail/MultiPartEmail.java,v
retrieving revision 1.6
diff -r1.6 MultiPartEmail.java
71a72
> //import org.apache.turbine.util.mail.*;
73,74c74,75
< /**
<  * This class is used to send multi-part internet email
---
> /** A multipart email
>  * <p>This class is used to send multi-part internet email
77,93c78,80
<  * To create a multi-part email you need to pass a Criteria
<  * object into the MultiPartEmail constructor which contains:
<  * <p>
<  * SENDER_EMAIL<br>
<  * SENDER_NAME<br>
<  * RECEIVER_EMAIL<br>
<  * RECEIVER_NAME<br>
<  * EMAIL_SUBJECT<br>
<  * EMAIL_BODY<br>
<  * ATTACHMENTS - a Vector containing EmailAttachment objects<p>
<  *
<  * Optionally you can pass in:
<  * <p>
<  * FILE_SERVER
<  * <p>
<  * If you do not this class will assume that the file you are 
<  * looking for is on the machine this code is running on.
---
>  * <p>To create a multi-part email, call the default constructor
>  * and then you can call setMsg() to set the message and
>  * call the different attach() methods.
97a85
>  * @author Regis Koenig
99c87,89
< public class MultiPartEmail extends Email {
---
> public class MultiPartEmail extends Email
> {
> 
101,103c91,99
<     Multipart emailBody;
<     /**
<      * Constructor used to initialize attributes.
---
>     protected MimeMultipart emailBody;
> 
>     /** The message container */ 
>     protected MimeBodyPart main;
> 
>     /** The file server if it exists */ 
>     private String fileServer = null;
> 
>     /** Initialize the multipart email
105c101,102
<     public MultiPartEmail( Criteria criteria ) throws Exception
---
>     public MultiPartEmail()
>         throws MessagingException
107,108c104
<         super.initialize( criteria );
<         this.init( criteria );
---
>         this.init();
110c106,121
<     private void init( Criteria criteria ) throws MessagingException,
IOException
---
>     
>     /** Constructor used to initialize attributes.
>      * <p> This method uses the criteria object to set the different
>      *   fields of the e-mail. The expected fields of the Criteria are:
>      * <li>SENDER_EMAIL
>      * <li>RECEIVER_EMAIL
>      * <li>EMAIL_SUBJECT
>      * <li>EMAIL_BODY
>      * <li>ATTACHMENTS - a Vector of EmailAttachment
>      * <li>FILE_SERVER - where the files are located. If not given, they are
>      *   assumed to be local.
>      *
>      * @deprecated  since Criteria is deprecated in mail API
>      */
>     public MultiPartEmail( Criteria criteria )
>         throws MessagingException
112,120c123,179
<         // create the text for the body
<         MimeBodyPart main = new MimeBodyPart();
<         main.setText( criteria.getString( EMAIL_BODY ) );
<         
<         // add the parts to the body
<         Multipart body = new MimeMultipart();
<         body.addBodyPart( main );
<         
<         Vector attachments = (Vector)criteria.get( ATTACHMENTS );
---
>         this.init();
>         this.initCriteria(criteria);
>     }
> 
>     /** Initialize the multipart email
>      */
>     protected void init()
>         throws MessagingException
>     {
>         super.init();
> 
>         fileServer = null;
>     
>         /* The body of the mail */
>         emailBody = new MimeMultipart();
>         //emailBody.setSubType("attachement");
>         message.setContent( emailBody );
> 
>         /* The main message content */
>         main = new MimeBodyPart();
>         emailBody.addBodyPart(main);
>     }
> 
> 
>     /** Uses the criteria to set the fields
>      * <p> This methos uses the criteria object to set the different
>      * fields of the e-mail. The expected fields of the Criteria are:
>      * <li>SENDER_EMAIL
>      * <li>RECEIVER_EMAIL
>      * <li>EMAIL_SUBJECT
>      * <li>EMAIL_BODY
>      * <li>ATTACHMENTS - a Vector of EmailAttachment
>      * <li>FILE_SERVER - where the files are located. If not given, they are
>      *   assumed to be local.
>      *
>      * @deprecated since the Criteria is deprecated
>      */
>     protected void initCriteria( Criteria criteria )
>         throws MessagingException
>     {
>         super.initCriteria(criteria);
> 
>         if( criteria.containsKey( EMAIL_BODY ) )
>             setMsg( criteria.getString( EMAIL_BODY ) );
>         else
>             setMsg("NO MESSAGE");
>     
>         Vector attachments;
>     
>         if( criteria.containsKey(ATTACHMENTS ) )
>             attachments = (Vector)criteria.get( ATTACHMENTS );
>         else
>             attachments = new Vector();
>     
>         if( criteria.containsKey(FILE_SERVER) )
>             fileServer = criteria.getString(FILE_SERVER);
>     
124,143c183,212
<             
<             String file = attachment.getPath();
<             String mimeType = new
MimetypesFileTypeMap().getContentType(file);
<             URL url = null;
<             
<             if ( criteria.containsKey(FILE_SERVER) )
<                 url = new URL( "file",
criteria.getString(FILE_SERVER), file );
<             else
<                 url = new URL( "file", null, file );
<             
<             // create the attachment(s) and add them to the body
<             MimeBodyPart mbp = new MimeBodyPart();
<             mbp.setDisposition( Part.ATTACHMENT );
<             mbp.setFileName ( attachment.getName() );
<             mbp.setDescription ( attachment.getDescription() );
<             mbp.setDataHandler ( new DataHandler( new
URLDataSource(url) ) );
<             
<             //new ByteArrayDataSource( url.openStream(), mimeType ) )
);
<            
<             body.addBodyPart( mbp );
---
>             attach( attachment );
>         }
>     }
> 
>     /** Set the message of the email
>      */
>     public Email setMsg(String msg)
>         throws MessagingException
>     {
>         main.setText(msg);
>         return this;
>     }
> 
>     /** attach an EmailAttachement
>      */
>     public MultiPartEmail attach( EmailAttachment attachment )
>         throws MessagingException
>     {
>         URL url = attachment.getURL();
>         if( url == null )
>         {
>             try
>             {
>                 String file = attachment.getPath();
>                 url = new URL( "file", fileServer, file );
>             }
>             catch( Exception e)
>             {
>                 throw new MessagingException("Cannot find file", e);
>             }
144a214,240
>         
>         return attach(url, attachment.getName(),
>                       attachment.getDescription(), attachment.getDisposition() );
>     }
> 
>     /** Attach a file located by its url.
>      * <p> The disposition of the file is set to mixed
>      */
>     public MultiPartEmail attach( URL url, String name, String description)
>         throws MessagingException
>     {
>         return attach( url, name, description, EmailAttachment.ATTACHMENT);
>     }
> 
>     /** Attach a file located by its url
>      * @param url the URL of the file (may be any valid URL)
>      * @param name the name field for the attachment
>      * @param description a description for the attachement
>      * @param disposition either mixed or inline
>      *
>      */
>     public MultiPartEmail attach( URL url, String name, String description, String 
>disposition)
>         throws MessagingException
>     {
> 
>         MimeBodyPart mbp = new MimeBodyPart();
>         emailBody.addBodyPart( mbp );
146,147c242,248
<         // set the email body
<         message.setContent( body );
---
>         mbp.setDisposition( disposition );
>         mbp.setFileName ( name );
>         mbp.setDescription ( description );
>         mbp.setDataHandler ( new DataHandler( new URLDataSource(url) ) );
> 
>         return this;
> 
Index: mail/SimpleEmail.java
===================================================================
RCS file:
/products/cvs/turbine/turbine/src/java/org/apache/turbine/util/mail/SimpleEmail.java,v
retrieving revision 1.3
diff -r1.3 SimpleEmail.java
76,85d75
<  * To create a simple email you need to pass a Criteria
<  * object into the SimpleEmail constructor which contains:
<  * <p>
<  * SENDER_EMAIL<br>
<  * SENDER_NAME<br>
<  * RECEIVER_EMAIL<br>
<  * RECEIVER_NAME<br>
<  * EMAIL_SUBJECT<br>
<  * EMAIL_BODY<br>
<  *
88a79
>  * @author Regis Koenig
90,94c81,85
< public class SimpleEmail extends Email {
<     /** Body portion of the email. */
<     String emailBody;
<     /**
<      * Constructor used to initialize attributes.
---
> public class SimpleEmail
>     extends Email
> {
> 
>     /** Default constructor
96c87,88
<     public SimpleEmail( Criteria criteria ) throws Exception
---
>     public SimpleEmail()
>         throws MessagingException
98,99c90
<         super.initialize( criteria );
<         this.init( criteria );
---
>         super.init();
101c92,123
<     private void init( Criteria criteria ) throws MessagingException
---
>     
>     /** Constructor used to initialize attributes.
>      * <p>To create a simple email you need to pass a Criteria
>      * object into the SimpleEmail constructor which contains:
>      * <li>SENDER_EMAIL
>      * <li>SENDER_NAME
>      * <li>RECEIVER_EMAIL
>      * <li>RECEIVER_NAME
>      * <li>EMAIL_SUBJECT
>      * <li>EMAIL_BODY
>      * @deprecated since Criteria is deprecated in mail API
>      */
>     public SimpleEmail( Criteria criteria )
>         throws MessagingException
>     {
>         super.init();
>         this.initCriteria(criteria);
>     }
>     
>     protected void initCriteria( Criteria criteria )
>         throws MessagingException
>     {
>         if( criteria.containsKey( EMAIL_BODY ) ) 
>             setMsg( criteria.getString( EMAIL_BODY ) );
>         else
>             setMsg("NO MESSAGE");
>     }
> 
>     /** Set the content of the mail
>      */
>     public Email setMsg( String msg )
>         throws MessagingException
103,104c125,126
<         // set the email body
<         message.setContent( criteria.getString( EMAIL_BODY ),
TEXT_PLAIN );
---
>         message.setContent( msg, TEXT_PLAIN );
>         return this;
Index: webmacro/WebMacroEmail.java
===================================================================
RCS file:
/products/cvs/turbine/turbine/src/java/org/apache/turbine/util/webmacro/WebMacroEmail.java,v
retrieving revision 1.4
diff -r1.4 WebMacroEmail.java
187,194c187,191
<             Criteria crit = new Criteria();
<             crit.add ( Email.SENDER_EMAIL, fromEmail );
<             crit.add ( Email.SENDER_NAME, fromName );
<             crit.add ( Email.RECEIVER_EMAIL, toEmail );
<             crit.add ( Email.RECEIVER_NAME, toName );
<             crit.add ( Email.EMAIL_SUBJECT, subject );
<             crit.add ( Email.EMAIL_BODY, body );        
<             SimpleEmail se = new SimpleEmail(crit);
---
>             SimpleEmail se = new SimpleEmail();
>             se.setFrom(fromEmail, fromName);
>             se.addTo(toEmail, toName);
>             se.setSubject(subject);
>             se.setMsg(body);


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to