org.apache.turbine.util.mail
Class MultiPartEmail

java.lang.Object
  |
  +--org.apache.turbine.util.mail.Email
        |
        +--org.apache.turbine.util.mail.MultiPartEmail
Direct Known Subclasses:
HtmlEmail

public class MultiPartEmail
extends Email

A multipart email.

This class is used to send multi-part internet email like messages with attachments.

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.

Version:
$Id: MultiPartEmail.java,v 1.1.1.1 2001/08/16 05:09:57 jvanzyl Exp $
Author:
Jon S. Stevens, Frank Y. Kim, Brett McLaughlin, Regis Koenig

Field Summary
protected  javax.mail.internet.MimeMultipart emailBody
          Body portion of the email.
private  java.lang.String fileServer
          The file server if it exists.
protected  javax.mail.internet.MimeBodyPart main
          The message container.
 
Fields inherited from class org.apache.turbine.util.mail.Email
ATTACHMENTS, bccList, ccList, 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, replyList, SENDER_EMAIL, SENDER_NAME, SMTP, TEXT_HTML, TEXT_PLAIN, toList, US_ASCII
 
Constructor Summary
MultiPartEmail()
          Initialize the multipart email.
MultiPartEmail(Criteria criteria)
          Constructor used to initialize attributes.
 
Method Summary
 MultiPartEmail attach(javax.activation.DataSource ds, java.lang.String name, java.lang.String description)
          Attach a file specified as a DataSource interface.
 MultiPartEmail attach(javax.activation.DataSource ds, java.lang.String name, java.lang.String description, java.lang.String disposition)
          Attach a file specified as a DataSource interface.
 MultiPartEmail attach(EmailAttachment attachment)
          Attach an EmailAttachement.
 MultiPartEmail attach(java.net.URL url, java.lang.String name, java.lang.String description)
          Attach a file located by its URL.
 MultiPartEmail attach(java.net.URL url, java.lang.String name, java.lang.String description, java.lang.String disposition)
          Attach a file located by its URL.
protected  void init()
          Initialize the multipart email.
protected  void initCriteria(Criteria criteria)
          Uses the criteria to set the fields.
 Email setMsg(java.lang.String msg)
          Set the message of the email.
 
Methods inherited from class org.apache.turbine.util.mail.Email
addBcc, addCc, addReplyTo, addTo, getMailSession, initialize, send, setCharset, setFrom, setSentDate, setSubject, toInternetAddressArray
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

emailBody

protected javax.mail.internet.MimeMultipart emailBody
Body portion of the email.

main

protected javax.mail.internet.MimeBodyPart main
The message container.

fileServer

private java.lang.String fileServer
The file server if it exists.
Constructor Detail

MultiPartEmail

public MultiPartEmail()
               throws javax.mail.MessagingException
Initialize the multipart email.
Throws:
MessagingException. -  

MultiPartEmail

public MultiPartEmail(Criteria criteria)
               throws javax.mail.MessagingException
Constructor used to initialize attributes.

This method uses the criteria object to set the different fields of the e-mail. The expected fields of the Criteria are:

Deprecated, since Criteria is deprecated in mail API.
Parameters:
criteria - A Criteria.
Throws:
MessagingException. -  
Method Detail

init

protected void init()
             throws javax.mail.MessagingException
Initialize the multipart email.
Overrides:
init in class Email
Throws:
MessagingException. -  

initCriteria

protected void initCriteria(Criteria criteria)
                     throws javax.mail.MessagingException
Uses the criteria to set the fields.

This method uses the criteria object to set the different fields of the e-mail. The expected fields of the Criteria are:

Deprecated, since the Criteria is deprecated.
Overrides:
initCriteria in class Email
Parameters:
criteria - A Criteria.
Throws:
MessagingException. -  

setMsg

public Email setMsg(java.lang.String msg)
             throws javax.mail.MessagingException
Set the message of the email.
Overrides:
setMsg in class Email
Parameters:
msg - A String.
Returns:
An Email.
Throws:
MessagingException. -  

attach

public MultiPartEmail attach(EmailAttachment attachment)
                      throws javax.mail.MessagingException
Attach an EmailAttachement.
Parameters:
attachment - An EmailAttachment.
Returns:
A MultiPartEmail.
Throws:
MessagingException. -  

attach

public MultiPartEmail attach(java.net.URL url,
                             java.lang.String name,
                             java.lang.String description)
                      throws javax.mail.MessagingException
Attach a file located by its URL. The disposition of the file is set to mixed.
Parameters:
url - The URL of the file (may be any valid URL).
name - The name field for the attachment.
description - A description for the attachment.
Returns:
A MultiPartEmail.
Throws:
MessagingException. -  

attach

public MultiPartEmail attach(java.net.URL url,
                             java.lang.String name,
                             java.lang.String description,
                             java.lang.String disposition)
                      throws javax.mail.MessagingException
Attach a file located by its URL.
Parameters:
url - The URL of the file (may be any valid URL).
name - The name field for the attachment.
description - A description for the attachment.
disposition - Either mixed or inline.
Returns:
A MultiPartEmail.
Throws:
MessagingException. -  

attach

public MultiPartEmail attach(javax.activation.DataSource ds,
                             java.lang.String name,
                             java.lang.String description)
                      throws javax.mail.MessagingException
Attach a file specified as a DataSource interface.
Parameters:
ds - A DataSource interface for the file.
name - The name field for the attachment.
description - A description for the attachment.
Returns:
A MultiPartEmail.
Throws:
MessagingException. -  

attach

public MultiPartEmail attach(javax.activation.DataSource ds,
                             java.lang.String name,
                             java.lang.String description,
                             java.lang.String disposition)
                      throws javax.mail.MessagingException
Attach a file specified as a DataSource interface.
Parameters:
ds - A DataSource interface for the file.
name - The name field for the attachment.
description - A description for the attachement.
disposition - Either mixed or inline.
Returns:
A MultiPartEmail.
Throws:
MessagingException. -  


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.