Qore jni Module  1.2.0
org.qore.lang.mailmessage.Message Class Reference

Java wrapper for the MailMessage::Message class in Qore. More...

Inheritance diagram for org.qore.lang.mailmessage.Message:
org.qore.jni.QoreObjectWrapper

Public Member Methods

 Message (QoreObject ds)
 creates the object
 
 Message (String n_sender, String n_subject) throws Throwable
 creates a Message object from the arguments given; this variant of the constructor is designed to be used to create a Message object for sending with the SmtpClient class More...
 
 Message (String msg) throws Throwable
 creates a Message object from raw message text from a received email message More...
 
String serialize () throws Throwable
 serializes the message to a string that can be sent to an SMTP server, for example More...
 
String[] addTO (String recipient) throws Throwable
 add a recipient to the Message's recipient list More...
 
String[] addCC (String recipient) throws Throwable
 add a recipient to the Message's cc list More...
 
String[] addBCC (String recipient) throws Throwable
 add a recipient to the Message's bcc list More...
 
String getSender () throws Throwable
 returns the sender's address in display format
 
String getFrom () throws Throwable
 returns the sender's email address
 
String[] getTO () throws Throwable
 returns the list of "To:" addresses
 
String[] getCC () throws Throwable
 returns the list of "CC:" addresses
 
String[] getBCC () throws Throwable
 returns the list of "BCC:" addresses
 
String getSubject () throws Throwable
 returns the subject of the Message
 
String[] getRecipients () throws Throwable
 return all the email addresses the message will be sent to, a combination of the "To:", "CC:", and "BCC:" lists
 
boolean sendPossible () throws Throwable
 returns True if the message can be sent, False if not More...
 
void checkSendPossible () throws Throwable
 throws a MESSAGE-ERROR exception if the Message cannot be sent More...
 
void setBody (String n_body, String n_enc, String n_content_type) throws Throwable
 sets or replaces the Message body More...
 
void setBody (String n_body, String n_enc) throws Throwable
 sets or replaces the Message body More...
 
void setBody (String n_body) throws Throwable
 sets or replaces the Message body More...
 
void setBody (byte[] n_body, String n_enc, String n_content_type) throws Throwable
 sets or replaces the Message body More...
 
void setBody (byte[] n_body, String n_enc) throws Throwable
 sets or replaces the Message body More...
 
void setBody (byte[] n_body) throws Throwable
 sets or replaces the Message body More...
 
void addBody (String str) throws Throwable
 concatenates a string to the message body More...
 
void addBody (byte[] bin) throws Throwable
 concatenates a binary object to the message body More...
 
Object getBody () throws Throwable
 returns the Message body
 
String getBodyTransferEncoding () throws Throwable
 returns the transfer encoding for the mssage body (see MessageEncodings for possible values)
 
void setHeader (String hdr) throws Throwable
 sets/replaces the Message headers More...
 
void setHeader (String[] hdrs) throws Throwable
 sets/replaces the list of Message headers from a list of header strings More...
 
void setHeader (Map< String, String > hdrs) throws Throwable
 sets/replaces the list of Message headers from a hash of header info More...
 
void addHeader (String hdr) throws Throwable
 adds a header to the Message More...
 
void addHeader (String[] hdrs) throws Throwable
 adds a list of headers to the Message More...
 
void addHeader (Map< String, String > hdrs) throws Throwable
 adds a hash of headers to the Message More...
 
String[] getHeader () throws Throwable
 returns the current Message headers as a list of strings
 
Map< String, String > getHeaders () throws Throwable
 returns the current Message headers as a hash
 
boolean important () throws Throwable
 returns the current importance setting More...
 
void important (boolean i) throws Throwable
 sets the importance setting More...
 
boolean receiptRead () throws Throwable
 returns the current read delivery receipt setting More...
 
void receiptRead (boolean arg) throws Throwable
 sets the read delivery receipt setting More...
 
boolean receiptDelivery () throws Throwable
 returns the delivery receipt setting More...
 
void receiptDelivery (boolean arg) throws Throwable
 sets the delivery receipt setting More...
 
void attach (String name, String mime, String att, String enc, Map< String, String > hdr) throws Throwable
 creates an attachment for the Message More...
 
void attach (String name, String mime, String att, String enc) throws Throwable
 creates an attachment for the Message More...
 
void attach (String name, String mime, String att) throws Throwable
 creates an attachment for the Message More...
 
void attach (String name, String mime, byte[] att, String enc, Map< String, String > hdr) throws Throwable
 creates an attachment for the Message More...
 
void attach (String name, String mime, byte[] att, String enc) throws Throwable
 creates an attachment for the Message More...
 
void attach (String name, String mime, byte[] att) throws Throwable
 creates an attachment for the Message More...
 
void attach (Attachment att) throws Throwable
 adds an Attachment to the Message More...
 
Attachment[] getAttachments () throws Throwable
 returns a list of Attachment objects for the Message
 
Part[] getParts () throws Throwable
 returns a list of non-attachment Part objects for the Message More...
 
String getHeaderString (String eol, boolean encode) throws Throwable
 returns a string of the message headers More...
 
String getHeaderString (String eol) throws Throwable
 returns a string of the message headers More...
 
String getHeaderString () throws Throwable
 returns a string of the message headers More...
 
String toString (boolean include_body) throws Throwable
 returns a multi-line string representing the Message More...
 
String toLine () throws Throwable
 returns a single line string summarizing the Message More...
 
- Public Member Methods inherited from org.qore.jni.QoreObjectWrapper
 QoreObjectWrapper (QoreObject obj)
 creates the wrapper object with the Qore object
 
void release ()
 releases the Qore object; do not call any further methods on the object after this call
 
QoreObject getQoreObject ()
 returns the Qore object
 
String className ()
 returns the class name for the Qore object
 
boolean instanceOf (String class_name)
 returns true if the object is an instance of the given class
 

Additional Inherited Members

- Private Attributes inherited from org.qore.jni.QoreObjectWrapper
QoreObject obj
 the wrapper Qore object
 

Detailed Description

Java wrapper for the MailMessage::Message class in Qore.

Note
Loads and initializes the Qore library and the jni module in static initialization if necessary

Constructor & Destructor Documentation

◆ Message() [1/2]

org.qore.lang.mailmessage.Message.Message ( String  n_sender,
String  n_subject 
) throws Throwable
inline

creates a Message object from the arguments given; this variant of the constructor is designed to be used to create a Message object for sending with the SmtpClient class

Use the addTo() method to add message recipients

Parameters
n_senderthe sender's email address; can be in the format "Full Display Name <name@example.com>"
n_subjectthe subject line for the email; the subject will be encoded with "Q" encoding
Exceptions
MESSAGE-CONSTRUCTOR-ERRORthe sender's email address is not valid; the subject is empty

◆ Message() [2/2]

org.qore.lang.mailmessage.Message.Message ( String  msg) throws Throwable
inline

creates a Message object from raw message text from a received email message

Parameters
msgthe raw message text as received
Exceptions
MESSAGE-PARSE-ERRORinvalid message data

Member Function Documentation

◆ addBCC()

String [] org.qore.lang.mailmessage.Message.addBCC ( String  recipient) throws Throwable
inline

add a recipient to the Message's bcc list

Parameters
recipientthe email address to send the message to (bcc)
Returns
the list of "BCC:" addresses
Exceptions
MESSAGE-ADDBCC-ERRORthe recipient's email address is invalid

◆ addBody() [1/2]

void org.qore.lang.mailmessage.Message.addBody ( byte[]  bin) throws Throwable
inline

concatenates a binary object to the message body

Parameters
binthe binary object to concatenate to the Message body
Exceptions
BODY-ERRORcannot concatenate a binary object to a string body

◆ addBody() [2/2]

void org.qore.lang.mailmessage.Message.addBody ( String  str) throws Throwable
inline

concatenates a string to the message body

Parameters
strthe string to concatenate to the Message body
Exceptions
BODY-ERRORcannot concatenate a string to a binary body

◆ addCC()

String [] org.qore.lang.mailmessage.Message.addCC ( String  recipient) throws Throwable
inline

add a recipient to the Message's cc list

Parameters
recipientthe email address to send the message to (cc)
Returns
the list of "CC:" addresses
Exceptions
MESSAGE-ADDCC-ERRORthe recipient's email address is invalid

◆ addHeader() [1/3]

void org.qore.lang.mailmessage.Message.addHeader ( Map< String, String >  hdrs) throws Throwable
inline

adds a hash of headers to the Message

Parameters
hdrsa hash of headers to add to the Message
Note
headers for importance, delivery receipt and read receipt will be added automatically and should not be included here

◆ addHeader() [2/3]

void org.qore.lang.mailmessage.Message.addHeader ( String  hdr) throws Throwable
inline

adds a header to the Message

Parameters
hdra header to add to the Message
Note
headers for importance, delivery receipt and read receipt will be added automatically and should not be included here

◆ addHeader() [3/3]

void org.qore.lang.mailmessage.Message.addHeader ( String[]  hdrs) throws Throwable
inline

adds a list of headers to the Message

Parameters
hdrsa list of headers to add to the Message
Note
headers for importance, delivery receipt and read receipt will be added automatically and should not be included here

◆ addTO()

String [] org.qore.lang.mailmessage.Message.addTO ( String  recipient) throws Throwable
inline

add a recipient to the Message's recipient list

Parameters
recipientthe email address to send the message to
Returns
the list of "To:" addresses
Exceptions
MESSAGE-ADDTO-ERRORthe recipient's email address is invalid

◆ attach() [1/7]

void org.qore.lang.mailmessage.Message.attach ( Attachment  att) throws Throwable
inline

adds an Attachment to the Message

Parameters
attthe Attachment to add to the Message

◆ attach() [2/7]

void org.qore.lang.mailmessage.Message.attach ( String  name,
String  mime,
byte[]  att 
) throws Throwable
inline

creates an attachment for the Message

Parameters
namethe name of the attachment to be displayed in the message, normally a file name without any path
mimethe mime type for the message
attthe attachment itself
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented
INVALID-ENCODINGthe encoding given cannot be used with data given

◆ attach() [3/7]

void org.qore.lang.mailmessage.Message.attach ( String  name,
String  mime,
byte[]  att,
String  enc 
) throws Throwable
inline

creates an attachment for the Message

Parameters
namethe name of the attachment to be displayed in the message, normally a file name without any path
mimethe mime type for the message
attthe attachment itself
encthe encoding type for the message (see MessageEncodings for possible values)
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented
INVALID-ENCODINGthe encoding given cannot be used with data given

◆ attach() [4/7]

void org.qore.lang.mailmessage.Message.attach ( String  name,
String  mime,
byte[]  att,
String  enc,
Map< String, String >  hdr 
) throws Throwable
inline

creates an attachment for the Message

Parameters
namethe name of the attachment to be displayed in the message, normally a file name without any path
mimethe mime type for the message
attthe attachment itself
encthe encoding type for the message (see MessageEncodings for possible values)
hdroptional headers for the MIME part for the attachment
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented
INVALID-ENCODINGthe encoding given cannot be used with data given

◆ attach() [5/7]

void org.qore.lang.mailmessage.Message.attach ( String  name,
String  mime,
String  att 
) throws Throwable
inline

creates an attachment for the Message

Parameters
namethe name of the attachment to be displayed in the message, normally a file name without any path
mimethe mime type for the message
attthe attachment itself
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented
INVALID-ENCODINGthe encoding given cannot be used with data given

◆ attach() [6/7]

void org.qore.lang.mailmessage.Message.attach ( String  name,
String  mime,
String  att,
String  enc 
) throws Throwable
inline

creates an attachment for the Message

Parameters
namethe name of the attachment to be displayed in the message, normally a file name without any path
mimethe mime type for the message
attthe attachment itself
encthe encoding type for the message (see MessageEncodings for possible values)
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented
INVALID-ENCODINGthe encoding given cannot be used with data given

◆ attach() [7/7]

void org.qore.lang.mailmessage.Message.attach ( String  name,
String  mime,
String  att,
String  enc,
Map< String, String >  hdr 
) throws Throwable
inline

creates an attachment for the Message

Parameters
namethe name of the attachment to be displayed in the message, normally a file name without any path
mimethe mime type for the message
attthe attachment itself
encthe encoding type for the message (see MessageEncodings for possible values)
hdroptional headers for the MIME part for the attachment
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented
INVALID-ENCODINGthe encoding given cannot be used with data given

◆ checkSendPossible()

void org.qore.lang.mailmessage.Message.checkSendPossible ( ) throws Throwable
inline

throws a MESSAGE-ERROR exception if the Message cannot be sent

To be able to send a message, there must be at least one recipient in the "To:" or the "CC:" or the "BCC:" lists and there must be a message body

See also
sendPossible()
Exceptions
MESSAGE-ERRORthe message is incomplete and cannot be sent

◆ getHeaderString() [1/3]

String org.qore.lang.mailmessage.Message.getHeaderString ( ) throws Throwable
inline

returns a string of the message headers

Returns
a string with all the message headers separated by the EOL marker

◆ getHeaderString() [2/3]

String org.qore.lang.mailmessage.Message.getHeaderString ( String  eol) throws Throwable
inline

returns a string of the message headers

Parameters
eolthe End-Of-Line marker for the string
Returns
a string with all the message headers separated by the EOL marker

◆ getHeaderString() [3/3]

String org.qore.lang.mailmessage.Message.getHeaderString ( String  eol,
boolean  encode 
) throws Throwable
inline

returns a string of the message headers

Parameters
eolthe End-Of-Line marker for the string
encodeencode non-ASCII values with quoted printable encoding (http://tools.ietf.org/html/rfc2047)
Returns
a string with all the message headers separated by the EOL marker

◆ getParts()

Part [] org.qore.lang.mailmessage.Message.getParts ( ) throws Throwable
inline

returns a list of non-attachment Part objects for the Message

these could represent alternative representations of the message body, for example

◆ important() [1/2]

boolean org.qore.lang.mailmessage.Message.important ( ) throws Throwable
inline

returns the current importance setting

if this is True, then the following headers will be sent:

  • Importance: high
  • X-Priority: 1
  • Priority: Urgent

◆ important() [2/2]

void org.qore.lang.mailmessage.Message.important ( boolean  i) throws Throwable
inline

sets the importance setting

if this is True, then the following headers will be sent:

  • Importance: high
  • X-Priority: 1
  • Priority: Urgent

◆ receiptDelivery() [1/2]

boolean org.qore.lang.mailmessage.Message.receiptDelivery ( ) throws Throwable
inline

returns the delivery receipt setting

if this is True, then the following header will be sent:

  • Disposition-Notification-To: <sender's email address>

◆ receiptDelivery() [2/2]

void org.qore.lang.mailmessage.Message.receiptDelivery ( boolean  arg) throws Throwable
inline

sets the delivery receipt setting

if this is True, then the following header will be sent:

  • Disposition-Notification-To: <sender's email address>

◆ receiptRead() [1/2]

boolean org.qore.lang.mailmessage.Message.receiptRead ( ) throws Throwable
inline

returns the current read delivery receipt setting

if this is True, then the following header will be sent:

  • Return-Receipt-To: <sender's email address>

◆ receiptRead() [2/2]

void org.qore.lang.mailmessage.Message.receiptRead ( boolean  arg) throws Throwable
inline

sets the read delivery receipt setting

if this is True, then the following header will be sent:

  • Return-Receipt-To: <sender's email address>

◆ sendPossible()

boolean org.qore.lang.mailmessage.Message.sendPossible ( ) throws Throwable
inline

returns True if the message can be sent, False if not

To be able to send a message, there must be at least one recipient in the "To:" or the "CC:" or the "BCC:" lists and there must be a message body

Returns
True if the message can be sent, False if not
See also
checkSendPossible()

◆ serialize()

String org.qore.lang.mailmessage.Message.serialize ( ) throws Throwable
inline

serializes the message to a string that can be sent to an SMTP server, for example

Exceptions
MESSAGE-ERRORthe message is incomplete and cannot be sent

◆ setBody() [1/6]

void org.qore.lang.mailmessage.Message.setBody ( byte[]  n_body) throws Throwable
inline

sets or replaces the Message body

Parameters
n_bodythe Message body to set
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented

◆ setBody() [2/6]

void org.qore.lang.mailmessage.Message.setBody ( byte[]  n_body,
String  n_enc 
) throws Throwable
inline

sets or replaces the Message body

Parameters
n_bodythe Message body to set
n_encthe encoding type for the message (see MessageEncodings for possible values)
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented

◆ setBody() [3/6]

void org.qore.lang.mailmessage.Message.setBody ( byte[]  n_body,
String  n_enc,
String  n_content_type 
) throws Throwable
inline

sets or replaces the Message body

Parameters
n_bodythe Message body to set
n_encthe encoding type for the message (see MessageEncodings for possible values)
n_content_typethe Content-Type for the message body, if any
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented

◆ setBody() [4/6]

void org.qore.lang.mailmessage.Message.setBody ( String  n_body) throws Throwable
inline

sets or replaces the Message body

Parameters
n_bodythe Message body to set
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented

◆ setBody() [5/6]

void org.qore.lang.mailmessage.Message.setBody ( String  n_body,
String  n_enc 
) throws Throwable
inline

sets or replaces the Message body

Parameters
n_bodythe Message body to set
n_encthe encoding type for the message (see MessageEncodings for possible values)
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented

◆ setBody() [6/6]

void org.qore.lang.mailmessage.Message.setBody ( String  n_body,
String  n_enc,
String  n_content_type 
) throws Throwable
inline

sets or replaces the Message body

Parameters
n_bodythe Message body to set
n_encthe encoding type for the message (see MessageEncodings for possible values)
n_content_typethe Content-Type for the message body, if any
Exceptions
UNKNOWN-ENCODINGthe message encoding value passed is unknown/unimplemented

◆ setHeader() [1/3]

void org.qore.lang.mailmessage.Message.setHeader ( Map< String, String >  hdrs) throws Throwable
inline

sets/replaces the list of Message headers from a hash of header info

Parameters
hdrsa hash of Message headers to set (replaces all message headers with the given hash)
Note
headers for importance, delivery receipt and read receipt will be added automatically and should not be included here

◆ setHeader() [2/3]

void org.qore.lang.mailmessage.Message.setHeader ( String  hdr) throws Throwable
inline

sets/replaces the Message headers

Parameters
hdra single string giving a single Message header to set (replaces all message headers with the given string)
Exceptions
HEADER-ERRORno ':' separator character found in header string
Note
headers for importance, delivery receipt and read receipt will be added automatically and should not be included here

◆ setHeader() [3/3]

void org.qore.lang.mailmessage.Message.setHeader ( String[]  hdrs) throws Throwable
inline

sets/replaces the list of Message headers from a list of header strings

Parameters
hdrsa list of Message header strings to set (replaces all message headers with the given list of strings)
Exceptions
HEADER-ERRORno ':' separator character found in header string
Note
headers for importance, delivery receipt and read receipt will be added automatically and should not be included here

◆ toLine()

String org.qore.lang.mailmessage.Message.toLine ( ) throws Throwable
inline

returns a single line string summarizing the Message

Returns
a single line string summarizing the Message

◆ toString()

String org.qore.lang.mailmessage.Message.toString ( boolean  include_body) throws Throwable
inline

returns a multi-line string representing the Message

Parameters
include_bodyif True the Message body will be included in the string output

The documentation for this class was generated from the following file: