Class Message


  • public class Message
    extends Part
    This class represents a MIME style e-mail message.
    Since:
    TotalCross 1.13
    • Field Detail

      • subject

        public java.lang.String subject
        The subject of this message
      • vFrom

        protected Vector vFrom
      • vRecipients

        protected Vector[] vRecipients
      • uidl

        public java.lang.String uidl
    • Constructor Detail

      • Message

        public Message()
        Creates a new empty message.
        Since:
        TotalCross 1.13
    • Method Detail

      • addHeader

        public void addHeader​(java.lang.String name,
                              java.lang.String value)
        Description copied from class: Part
        Add this value to the existing values for this header name.
        Overrides:
        addHeader in class Part
        Parameters:
        name - the name of this header
        value - the value for this header
      • addRecipient

        public void addRecipient​(int type,
                                 Address address)
        Add this recipient address to the existing ones of the given type.
        Parameters:
        type - the recipient type
        address - the address
        Throws:
        java.lang.IllegalArgumentException - If the given recipient type is not valid
        java.lang.NullPointerException - if the given address is null
        Since:
        TotalCross 1.13
      • addRecipients

        public void addRecipients​(int type,
                                  Address[] addresses)
        Add these recipient addresses to the existing ones of the given type.
        Parameters:
        type - the recipient type
        addresses - the addresses
        Throws:
        java.lang.IllegalArgumentException - If the given recipient type is not valid
        java.lang.NullPointerException - if addresses is null, or has a null value
        Since:
        TotalCross 1.13
      • addFrom

        public void addFrom​(Address[] addresses)
        Add these addresses to the existing "From" attribute.
        Parameters:
        addresses - the senders
        Since:
        TotalCross 1.22
      • setFrom

        public void setFrom​(Address address)
        Set the "From" attribute in this Message.
        Parameters:
        address - the sender
        Since:
        TotalCross 1.22
      • getFrom

        public Address[] getFrom()
        Returns the "From" attribute. The "From" attribute contains the identity of the person(s) who wished this message to be sent. In certain implementations, this may be different from the entity that actually sent the message. This method returns null if this attribute is not present in this message. Returns an empty array if this attribute is present, but contains no addresses.
        Returns:
        array of Address objects
        Since:
        TotalCross 1.22
      • writeTo

        public void writeTo​(Stream stream)
                     throws MessagingException
        Description copied from class: Part
        Writes this part to the given Stream. The output is typically an aggregation of the Part attributes and an appropriately encoded byte stream from its 'content'. Classes that extends the Part class decide on the appropriate encoding algorithm to be used. The received Stream is typically used for sending.
        Overrides:
        writeTo in class Part
        Parameters:
        stream - the output stream that will receive this part's encoded representation
        Throws:
        MessagingException - if an error occurs fetching the data to be written
      • reply

        public Message reply​(boolean replyToAll)
                      throws AddressException
        Get a new Message suitable for a reply to this message. The new Message will have its attributes and headers set up appropriately. Note that this new message object will be empty, that is, it will not have a "content". These will have to be suitably filled in by the client. If replyToAll is set, the new Message will be addressed to all recipients of this message. Otherwise, the reply will be addressed to only the sender of this message. The "Subject" field is filled in with the original subject prefixed with "Re:" (unless it already starts with "Re:"). The reply message will use the same session as this message. NOTE: The replyToAll feature is NOT supported yet, messages returned by this method will contain only the original sender as recipient.
        Parameters:
        replyToAll - reply should be sent to all recipients of this message
        Returns:
        the reply Message
        Throws:
        AddressException
        Since:
        TotalCross 1.13