Package wt.mail

Class EMailMessage

All Implemented Interfaces:
Externalizable, Serializable, wt.fc._NetFactor, wt.fc._ObjectMappable, NetFactor, ObjectMappable, Evolvable

@GenAsObjectMappable(serializable=EVOLVABLE,versions={-9180647176255283613L,8497996368898185323L,2587670180656254834L,-8355462585073684381L,-8109842924669105710L,7349267023584028560L},properties={@GeneratedProperty(name="subjectResource",type=java.lang.String.class,accessors=@PropertyAccessors(getAccess=PROTECTED,setExceptions={})),@GeneratedProperty(name="subjectKey",type=java.lang.String.class,accessors=@PropertyAccessors(getAccess=PROTECTED,setExceptions={})),@GeneratedProperty(name="subjectInserts",type=java.lang.Object[][].class,accessors=@PropertyAccessors(getAccess=PROTECTED,setExceptions={}),columnProperties=@ColumnProperties(columnType=BLOB)),@GeneratedProperty(name="originator",type=WTPrincipalReference.class,supportedAPI=PUBLIC,accessors=@PropertyAccessors(setExceptions={})),@GeneratedProperty(name="multipartSubtype",type=java.lang.String.class,initialValue="\"mixed\"",supportedAPI=PUBLIC,accessors=@PropertyAccessors(setExceptions={})),@GeneratedProperty(name="recipients",type=java.util.Vector.class,accessors=@PropertyAccessors(getAccess=PRIVATE,setExceptions={}),columnProperties=@ColumnProperties(columnType=BLOB)),@GeneratedProperty(name="ccRecipients",type=java.util.Vector.class,accessors=@PropertyAccessors(getAccess=PRIVATE),columnProperties=@ColumnProperties(columnType=BLOB)),@GeneratedProperty(name="bccRecipients",type=java.util.Vector.class,accessors=@PropertyAccessors(getAccess=PRIVATE),columnProperties=@ColumnProperties(columnType=BLOB)),@GeneratedProperty(name="recipientLocaleList",type=java.util.Vector.class,accessors=@PropertyAccessors(getAccess=PRIVATE),columnProperties=@ColumnProperties(columnType=BLOB)),@GeneratedProperty(name="parts",type=java.util.Vector.class,accessors=@PropertyAccessors(getAccess=PRIVATE,setExceptions={}),columnProperties=@ColumnProperties(columnType=BLOB)),@GeneratedProperty(name="emailList",type=java.lang.String[][].class,accessors=@PropertyAccessors(getAccess=PRIVATE),columnProperties=@ColumnProperties(columnType=BLOB)),@GeneratedProperty(name="attachments",type=java.lang.String[][].class,accessors=@PropertyAccessors(getAccess=PRIVATE),columnProperties=@ColumnProperties(columnType=BLOB)),@GeneratedProperty(name="attachContentType",javaDoc="A bitmask specifies the types of attachments to be included in the email message and whether the attachments should be sent out in a single email or multiple emails with one attachment per email.",type=int.class,initialValue="0",accessors=@PropertyAccessors(getAccess=PRIVATE)),@GeneratedProperty(name="retryEmailAddrs",type=java.lang.String[][].class,accessors=@PropertyAccessors(getAccess=PRIVATE),columnProperties=@ColumnProperties(columnType=BLOB))}) public class EMailMessage extends _EMailMessage
An instance of this class represents an e-mail message. The subject and text bodies of the e-mail message are defined in terms of resource bundles, keys of entries within the bundles, and arrays of strings to be inserted into the entries. Various types of objects from which principals can be obtained may be added as recipients of the message. The message may be constructed as a multipart message, and the individual parts can be specified as text bodies or as URL's from which objects of any type may be read.

Use the newEMailMessage static factory method(s), not the EMailMessage constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: true

Extendable: false

See Also:
  • Method Details

    • newEMailMessage

      public static EMailMessage newEMailMessage() throws WTException
      Construct a new instance with no recipients, subject, or content.

      Supported API: true
      Returns:
      EMailMessage
      Throws:
      WTException
    • initialize

      protected void initialize() throws WTException
      Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

      Supported API: true
      Throws:
      WTException
    • setOriginator

      public void setOriginator(WTPrincipal originator) throws WTException
      Set the originator of the message.

      Supported API: true
      Parameters:
      originator - The principal who is designated as the originator of the message.
      Throws:
      WTException
    • setSubject

      public void setSubject(String resource, String key, Object[] inserts)
      Set the resource bundle, key, and inserts from which the subject of the message will be obtained.

      Supported API: true
      Parameters:
      resource - The name of the resource bundle containing the subject.
      key - The key that identifies the entry within the resource bundle providing the message subject.
      inserts - The objects to be inserted into the resource bundle entry to produce the subject string.
    • addRecipient

      public void addRecipient(WTPrincipal recipient) throws WTException
      Add a specific principal as a recipient of the message.

      Supported API: true
      Parameters:
      recipient - The principal to add as recipient.
      Throws:
      WTException
    • addRecipient

      public void addRecipient(WTPrincipalReference recipient) throws WTException
      Add a specific principal by reference as a recipient of the message.

      Supported API: true
      Parameters:
      recipient - The reference to the principal to be added as recipient.
      Throws:
      WTException
    • getRecipients

      public Enumeration getRecipients()
      Return the current list of recipients as an enumeration of objects.

      Supported API: true
      Returns:
      Enumeration
    • addPart

      public void addPart(String resource, String key, Object[] inserts, String contentType)
      Add a textual message body of a specific MIME content type to the message. The message body is produced from a resource within a resource bundle.

      Supported API: true
      Parameters:
      resource - The name of the resource bundle.
      key - The key of the resource within the bundle that contains the message body.
      inserts - The objects, if any, to be inserted into the message body.
      contentType - The MIME content type of the message body, .e.g., "text/html" or "text/plain".
    • addPart

      public void addPart(URL url)
      Add a message body whose content is read from a URL. The content can have any type. The MIME content type will be obtained from the URL object after a connection to the remote resource is established.

      Supported API: true
      Parameters:
      url - The URL of the remote resource that provides the message body.
    • addEmailAddress

      public void addEmailAddress(String[] emailAddresses)
      Adds the specified email addresses as recipients of the message. No effort is made to validate the format of the email addresses. When the email is sent each specified email address is checked to see if it maps to a Windchill user so the mail can be formatted for that user's locale. For email addresses that don't map to Windchill users, the email is formatted for the default locale.

      Supported API: true
      Parameters:
      emailAddresses - An array of one or more email address Strings in the standard format localpart@domain (e.g., joe.smith@example.org).
    • send

      public void send(boolean immediate) throws WTException
      Submit the message for delivery to its intended recipients. If immediate is specified as true, the message is submitted to the mail server for delivery immediately. In this case, all recipients are resolved, all message bodies are assembled, and the message is submitted to the mail server before the method returns. Otherwise, if immediate is specified as false, the message is placed in a Windchill queue where it is submitted for delivery as a background process. In this case, the method returns immediately and resolution of recipients and assembly of message bodies are deferred until the background process begins handling the message.

      Supported API: true
      Parameters:
      immediate - Indicates whether to submit the message to the mail server immediately (true), or place the message in a queue where it will be submitted to the mail server by a background process (false).
      Throws:
      WTException