Package com.aquafold.openapi.mail
Interface AQMailMessage
-
public interface AQMailMessageThis interface defines an email message which can be delivered to recipients via eitherAQSmtpServerorAQMailQueue.An instance of the object that implements the
AQMailMessageinterface can be instantiated viaaqua.mail.newMessage()alias.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddBCCRecipient(java.lang.String address)Add a valid email address, or a list of comma separated email addresses, to the list of blind carbon copy (BCC:) recipients.voidaddByteArrayAttachment(byte[] bytes, java.lang.String attachmentName)Adds a byte array as an attachment.voidaddCCRecipient(java.lang.String address)Add a valid email address, or a list of comma separated email addresses, to the list of carbon copy (CC:) recipients.voidaddFileAttachment(java.io.File filename)Add a file on the local file system as an attachment.voidaddFileAttachment(java.lang.String filename)Add a file on the local file system as an attachment.voidaddFileAttachment(java.lang.String filename, java.lang.String attachmentName)Add a file on the local file system as an attachment with attachment name specified.voidaddHadoopFileAttachment(AQHadoopDistributedFileSystem system, java.lang.String filename, java.lang.String attachmentName)Add a file on a Hadoop file system as an attachment.voidaddProjectFileAttachment(AQProjectFile file)Adds aAQProjectFileas an attachment.voidaddProjectFileAttachment(AQProjectFile file, java.lang.String attachmentName)Adds aAQProjectFileas an attachment.voidaddReplyTo(java.lang.String replyTo)Add a valid email address, or a list of comma separated email addresses, to the list of addresses to which replies should be directed.voidaddToRecipient(java.lang.String recipient)Add a valid email address, or a list of comma separated email addresses, to the list of recipients.java.lang.String[]getBCCRecipients()Returns a list of BCC: recipients, an empty array is returned if recipients are not defined.java.lang.String[]getCCRecipients()Returns a list of CC: recipients, an empty array is returned if recipients are not defined.java.lang.String[]getFileAttachments()Returns the list of file attachments, an empty array is returned if this message contains no file attachments.java.lang.StringgetFrom()Returns message sender email address or null if the address is not defined.java.lang.StringgetHtmlText()Returns message HTML text content or null if the HTML content is not defined.java.lang.String[]getReplyTo()Returns the list of addresses to which replies should be directed, an empty array is returned if Reply-To addresses are not defined.java.lang.StringgetSubject()Returns message subject or null if the message subject is not defined.java.lang.StringgetText()Returns message plain text content or null if the plain text content is not defined.java.lang.String[]getToRecipients()Returns a list of recipients, an empty array is returned if recipients are not defined.voidqueue()Delivers this message to recipients using the defaultAQMailQueue.voidsend()Delivers this message to recipients using the defaultAQSmtpServer.voidsetFrom(java.lang.String sender)Sets sender email address.voidsetHtmlText(java.lang.String htmlText)Set message HTML content.voidsetSubject(java.lang.String subject)Set message subject.voidsetText(java.lang.String text)Set message plain text content.
-
-
-
Method Detail
-
setFrom
void setFrom(java.lang.String sender)
Sets sender email address. Sender email address is required in order to get mail delivered.- Parameters:
sender- Sender email address.
-
getFrom
java.lang.String getFrom()
Returns message sender email address or null if the address is not defined.- Returns:
- the from
-
addToRecipient
void addToRecipient(java.lang.String recipient)
Add a valid email address, or a list of comma separated email addresses, to the list of recipients. At least one recipient needs to be defined in order to get mail delivered.- Parameters:
recipient- To: email address, or a list of comma separated email addresses.
-
getToRecipients
java.lang.String[] getToRecipients()
Returns a list of recipients, an empty array is returned if recipients are not defined.- Returns:
- the recipients
-
addCCRecipient
void addCCRecipient(java.lang.String address)
Add a valid email address, or a list of comma separated email addresses, to the list of carbon copy (CC:) recipients.- Parameters:
address- CC: email address, or a list of comma separated email addresses.
-
getCCRecipients
java.lang.String[] getCCRecipients()
Returns a list of CC: recipients, an empty array is returned if recipients are not defined.- Returns:
- the CC recipients
-
addBCCRecipient
void addBCCRecipient(java.lang.String address)
Add a valid email address, or a list of comma separated email addresses, to the list of blind carbon copy (BCC:) recipients.- Parameters:
address- BCC: email address, or a list of comma separated email addresses.
-
getBCCRecipients
java.lang.String[] getBCCRecipients()
Returns a list of BCC: recipients, an empty array is returned if recipients are not defined.- Returns:
- the BCC recipients
-
addReplyTo
void addReplyTo(java.lang.String replyTo)
Add a valid email address, or a list of comma separated email addresses, to the list of addresses to which replies should be directed.- Parameters:
replyTo- email address, or a list of comma separated email addresses.
-
getReplyTo
java.lang.String[] getReplyTo()
Returns the list of addresses to which replies should be directed, an empty array is returned if Reply-To addresses are not defined.- Returns:
- the reply to
-
setSubject
void setSubject(java.lang.String subject)
Set message subject. Subject cannot be null, empty string is fine.- Parameters:
subject- Message subject.
-
getSubject
java.lang.String getSubject()
Returns message subject or null if the message subject is not defined.- Returns:
- the subject
-
setText
void setText(java.lang.String text)
Set message plain text content.- Parameters:
text- Message plain text content, ignored if null.
-
getText
java.lang.String getText()
Returns message plain text content or null if the plain text content is not defined.- Returns:
- the text
-
setHtmlText
void setHtmlText(java.lang.String htmlText)
Set message HTML content.- Parameters:
htmlText- Message HTML content, ignored if null.
-
getHtmlText
java.lang.String getHtmlText()
Returns message HTML text content or null if the HTML content is not defined.- Returns:
- the HTML text
-
addFileAttachment
void addFileAttachment(java.lang.String filename) throws java.lang.ExceptionAdd a file on the local file system as an attachment. The base name of the specified file name will be used as attachment name.- Parameters:
filename- the file name.- Throws:
java.lang.Exception- if the specified file does not exist or inaccessible
-
addFileAttachment
void addFileAttachment(java.io.File filename) throws java.lang.ExceptionAdd a file on the local file system as an attachment. The base name of the specified file will be used as attachment name.- Parameters:
filename- the file name.- Throws:
java.lang.Exception- if the specified file does not exist or inaccessible
-
addFileAttachment
void addFileAttachment(java.lang.String filename, java.lang.String attachmentName) throws java.lang.ExceptionAdd a file on the local file system as an attachment with attachment name specified.- Parameters:
filename- the file name.attachmentName- the name to be used to name the attachment- Throws:
java.lang.Exception- if the specified file does not exist or inaccessible
-
getFileAttachments
java.lang.String[] getFileAttachments()
Returns the list of file attachments, an empty array is returned if this message contains no file attachments. File attachments are those attachments added byaddFileAttachment(String filename)oraddFileAttachment(File filename).- Returns:
- the file attachments
-
addByteArrayAttachment
void addByteArrayAttachment(byte[] bytes, java.lang.String attachmentName)Adds a byte array as an attachment.- Parameters:
bytes- the byte arrayattachmentName- the name to be used to name the attachment
-
addProjectFileAttachment
void addProjectFileAttachment(AQProjectFile file)
Adds aAQProjectFileas an attachment. The base name of the specified file will be used as attachment name.- Parameters:
file- the project file
-
addProjectFileAttachment
void addProjectFileAttachment(AQProjectFile file, java.lang.String attachmentName)
Adds aAQProjectFileas an attachment.- Parameters:
file- the project fileattachmentName- the name to be used to name the attachment
-
addHadoopFileAttachment
void addHadoopFileAttachment(AQHadoopDistributedFileSystem system, java.lang.String filename, java.lang.String attachmentName) throws java.lang.Exception
Add a file on a Hadoop file system as an attachment.- Parameters:
system- the Hadoop file system where file is locatedfilename- the name of the file on the Hadoop file systemattachmentName- the name to be used to name the attachment- Throws:
java.lang.Exception- if the specified file does not exist or inaccessible
-
send
void send() throws java.lang.Exception
Delivers this message to recipients using the defaultAQSmtpServer.- Throws:
java.lang.Exception- On error
-
queue
void queue() throws java.lang.ExceptionDelivers this message to recipients using the defaultAQMailQueue.- Throws:
java.lang.Exception- On error
-
-