Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mentawai.mail
Class MultiPartEmail  view MultiPartEmail download MultiPartEmail.java

java.lang.Object
  extended byorg.mentawai.mail.Email
      extended byorg.mentawai.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.3 2005/07/29 21:23:16 soliveira Exp $

Field Summary
private  boolean boolHasAttachments
          Indicates if attachments have been added to the message
private  javax.mail.internet.MimeMultipart container
          Body portion of the email.
private  boolean initialized
          Indicates if the message has been initialized
private  javax.mail.internet.MimeBodyPart primaryBodyPart
          The message container.
private  java.lang.String subType
          The MIME subtype.
 
Fields inherited from class org.mentawai.mail.Email
ATTACHMENTS, authenticator, bccList, bounceAddress, ccList, charset, content, CONTENT_TYPE, contentType, debug, EMAIL_BODY, EMAIL_SUBJECT, emailBody, FILE_SERVER, fromAddress, headers, hostName, ISO_8859_1, KOI8_R, MAIL_DEBUG, MAIL_HOST, MAIL_PORT, MAIL_SMTP_AUTH, MAIL_SMTP_FROM, MAIL_TRANSPORT_PROTOCOL, message, popBeforeSmtp, popHost, popPassword, popUsername, RECEIVER_EMAIL, RECEIVER_NAME, replyList, SENDER_EMAIL, SENDER_NAME, sentDate, SMTP, smtpPort, subject, TEXT_HTML, TEXT_PLAIN, toList, US_ASCII
 
Constructor Summary
MultiPartEmail()
           
 
Method Summary
 Email addPart(javax.mail.internet.MimeMultipart multipart)
          Add a new part to the email.
 Email addPart(javax.mail.internet.MimeMultipart multipart, int index)
          Add a new part to the email.
 Email addPart(java.lang.String content, java.lang.String contentType)
          Add a new part to the email.
 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  javax.mail.internet.MimeMultipart getContainer()
          Gets the message container.
protected  javax.mail.internet.MimeBodyPart getPrimaryBodyPart()
          Gets first body part of the message.
 java.lang.String getSubType()
          Get the MIME subtype of the email.
protected  void init()
          Initialize the multipart email.
 boolean isBoolHasAttachments()
           
 void send()
          Sends the mail message
 void setBoolHasAttachments(boolean b)
           
 Email setMsg(java.lang.String msg)
          Set the message of the email.
 void setSubType(java.lang.String aSubType)
          Set the MIME subtype of the email.
 
Methods inherited from class org.mentawai.mail.Email
addBcc, addBcc, addCc, addCc, addHeader, addReplyTo, addReplyTo, addTo, addTo, getMailSession, getSentDate, setAuthentication, setAuthenticator, setBcc, setBounceAddress, setCc, setCharset, setContent, setContent, setDebug, setDefaultAuthentication, setDefaultBounceAddress, setDefaultCharset, setDefaultFrom, setDefaultHostName, setFrom, setFrom, setHeaders, setHostName, setMailSession, setPopBeforeSmtp, setSentDate, setSmtpPort, setSubject, setTo, toInternetAddressArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

container

private javax.mail.internet.MimeMultipart container
Body portion of the email.


primaryBodyPart

private javax.mail.internet.MimeBodyPart primaryBodyPart
The message container.


subType

private java.lang.String subType
The MIME subtype.


initialized

private boolean initialized
Indicates if the message has been initialized


boolHasAttachments

private boolean boolHasAttachments
Indicates if attachments have been added to the message

Constructor Detail

MultiPartEmail

public MultiPartEmail()
Method Detail

setSubType

public void setSubType(java.lang.String aSubType)
Set the MIME subtype of the email.


getSubType

public java.lang.String getSubType()
Get the MIME subtype of the email.


addPart

public Email addPart(java.lang.String content,
                     java.lang.String contentType)
              throws EmailException
Add a new part to the email.


addPart

public Email addPart(javax.mail.internet.MimeMultipart multipart)
              throws EmailException
Add a new part to the email.


addPart

public Email addPart(javax.mail.internet.MimeMultipart multipart,
                     int index)
              throws EmailException
Add a new part to the email.


init

protected void init()
Initialize the multipart email.


setMsg

public Email setMsg(java.lang.String msg)
             throws EmailException
Set the message of the email.

Specified by:
setMsg in class Email

send

public void send()
          throws EmailException
Sends the mail message

Overrides:
send in class Email

attach

public MultiPartEmail attach(EmailAttachment attachment)
                      throws EmailException
Attach an EmailAttachement.


attach

public MultiPartEmail attach(java.net.URL url,
                             java.lang.String name,
                             java.lang.String description)
                      throws EmailException
Attach a file located by its URL. The disposition of the file is set to mixed.


attach

public MultiPartEmail attach(java.net.URL url,
                             java.lang.String name,
                             java.lang.String description,
                             java.lang.String disposition)
                      throws EmailException
Attach a file located by its URL.


attach

public MultiPartEmail attach(javax.activation.DataSource ds,
                             java.lang.String name,
                             java.lang.String description)
                      throws EmailException
Attach a file specified as a DataSource interface.


attach

public MultiPartEmail attach(javax.activation.DataSource ds,
                             java.lang.String name,
                             java.lang.String description,
                             java.lang.String disposition)
                      throws EmailException
Attach a file specified as a DataSource interface.


getPrimaryBodyPart

protected javax.mail.internet.MimeBodyPart getPrimaryBodyPart()
                                                       throws javax.mail.MessagingException
Gets first body part of the message.


getContainer

protected javax.mail.internet.MimeMultipart getContainer()
Gets the message container.


isBoolHasAttachments

public boolean isBoolHasAttachments()

setBoolHasAttachments

public void setBoolHasAttachments(boolean b)