public class MailMessage
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| static java.lang.String | DEFAULT_REDIRECT_EMAIL_RECIPIENTSDefault Redirect Email Recipients | 
| static java.lang.String | REDIRECT_EMAIL_RECIPIENTSIgnore selected recipients and send emails to recipients supplied by system property | 
| Constructor and Description | 
|---|
| MailMessage() | 
| Modifier and Type | Method and Description | 
|---|---|
| MailAttachment | addAttachment(DBFile file,
             java.lang.String attachmentName)Adds an attachment to the email | 
| MailAttachment | addAttachment(java.io.File file,
             java.lang.String attachmentName)Adds an attachment to the email | 
| MailAttachment | addAttachment(MailAttachment ma)Adds an attachment to the email | 
| protected MimeMultipart | addAttachments(MimeMultipart mp,
              java.lang.String sendHTML)Creates body elements for each attachment and adds to supplied MimeMultipart | 
| MailMessage | addBCC(java.lang.String recipient)Adds a recipient to the BCC list | 
| MailMessage | addCC(java.lang.String recipient)This function adds the CC recipients | 
| MailMessage | addRecipient(java.lang.String recipient)Adds a recipient to the TO list | 
| MailMessage | addRecipient(java.lang.String type,
            java.lang.String recipient)Adds the recipient to the recipient list based on the recipient type | 
| MailMessage | addRecipients(java.lang.String type,
             java.lang.String[] recipients)Adds a list of recipients to the recipient list based on type | 
| MailMessage | clearRecipients()Clears the recipient lists | 
| protected MimeMessage | constructMessage(Session session) | 
| java.lang.String | generateMimeBody()Generate the mime body | 
| java.lang.String | getCalcReplyTo()Determines the REPLY TO address depending on information supplied | 
| java.lang.String | getFrom()Returns the FROM email address | 
| java.lang.String | getHTML()Returns the current body text in HTML format | 
| MimeMessage | getMessage()Constructs the email | 
| boolean | getReadReceipt()Returns the current setting for the read receipt | 
| java.lang.String[] | getRecipients()Returns the list of recipients in the TO list | 
| java.lang.String | getReplyTo()Returns the REPLY TO email address | 
| EmailUtil.ConnectionSecurity | getSecurity()security | 
| boolean | getServerReceipt()Returns the current setting for the server receipt | 
| java.lang.String | getSMTPPassword()Returns the current setting for user used to connect to the SMTP server
 This will return the setting if manually set or the current value from system property
 mail.smtp.user | 
| java.lang.String | getSMTPServer()Retrieves the current setting for the SMTP server url
 This will return the setting if manually set or the current value from system property
 mail.smtp.host | 
| java.lang.String | getSMTPUser()Returns the current setting for user used to connect to the SMTP server
 This will return the setting if manually set or the current value from system property
 mail.smtp.user | 
| java.lang.String | getSubject()Returns the subject of the email | 
| java.lang.String | getText()Returns the text used in the body of the email | 
| boolean | hasImageEmbedded()get the hasImageEmbedded value | 
| MailAttachment[] | listAttachments()Returns the list of attachments for this email
 The returned objects can be a combination of File and DBFile objects | 
| java.lang.String | makeHTML() | 
| void | send()Constructs the email and sends to SMTP server
 
 error codes | 
| MailMessage | setDataSource(VirtualDB layer)sets the datasource to find the systemProperty for recipient list. | 
| MailMessage | setEmbedRemoteImages(boolean flag)fetch and embed images. | 
| MailMessage | setFrom(java.lang.String from)Sets the email address that the email is to be sent from | 
| MailMessage | setHasImageEmbedded(boolean hasImageEmbedded)set the hasImageEmbedded value, if true, the HTML IMG tag would show the image in the email body. | 
| MailMessage | setHeader(java.lang.String key,
         java.lang.String value)Sets a specific header in the email | 
| MailMessage | setHTML(java.lang.String html)Sets the body text in HTML format | 
| MailMessage | setReadReceipt(boolean flag)Requests that the person receiving the email is prompted to notify the sender that
 it has been received | 
| MailMessage | setReplyTo(java.lang.String replyTo)Sets the REPLY To email address. | 
| MailMessage | setSecurity(EmailUtil.ConnectionSecurity security)Use TLS | 
| MailMessage | setServerReceipt(boolean flag)Requests that the person receiving the email is prompted to notify the sender that
 it has been received | 
| MailMessage | setSMTPPassword(java.lang.String password)Sets the password that should be used when connecting to SMTP server | 
| MailMessage | setSMTPPort(int port)Sets the port used to connect to the SMTP server | 
| MailMessage | setSMTPServer(java.lang.String host)Sets the URL of the SMTP server | 
| MailMessage | setSMTPUser(java.lang.String user)Sets the user used to connect to the SMTP server | 
| MailMessage | setSubject(java.lang.String subject)Set the subject to be used in the mail message | 
| MailMessage | setText(java.lang.String text)Sets the text to be used in body of the email | 
public static final java.lang.String REDIRECT_EMAIL_RECIPIENTS
public static final java.lang.String DEFAULT_REDIRECT_EMAIL_RECIPIENTS
@Nonnull public MailMessage setSMTPServer(@Nullable java.lang.String host)
host - - the url of the SMTP server@CheckReturnValue @Nullable public java.lang.String getSMTPServer()
@Nonnull public MailMessage setSMTPUser(@Nonnull java.lang.String user)
user - - the username to use for the connection@Nonnull public MailMessage setDataSource(@Nullable VirtualDB layer)
layer - - the layer@CheckReturnValue @Nullable public java.lang.String getSMTPUser()
@Nonnull public MailMessage setSMTPPassword(@Nullable java.lang.String password)
password - - password to be used@CheckReturnValue @Nullable public java.lang.String getSMTPPassword()
@Nonnull public MailMessage setSMTPPort(@Nonnegative int port)
port - - the port to use for the connection@Nonnull public MailMessage setSecurity(@Nonnull EmailUtil.ConnectionSecurity security)
security - the security@CheckReturnValue @Nonnull public EmailUtil.ConnectionSecurity getSecurity()
@Nonnull public MailMessage setSubject(@Nonnull java.lang.String subject)
subject - - the subject for the email@CheckReturnValue @Nullable public java.lang.String getSubject()
@Nonnull public MailMessage setText(@Nonnull java.lang.String text)
text - - The body text@CheckReturnValue @Nonnull public java.lang.String getText()
@Nonnull public MailMessage setHTML(@Nullable java.lang.String html)
html - - body text in HTML format@CheckReturnValue @Nullable public java.lang.String getHTML()
@CheckReturnValue public boolean hasImageEmbedded()
@Nonnull public MailMessage setHasImageEmbedded(boolean hasImageEmbedded)
hasImageEmbedded - hasImageEmbedded@Nonnull public MailMessage setFrom(@Nullable java.lang.String from) throws InvalidDataException
from - - the FROM email addressInvalidDataException@CheckReturnValue @Nullable public java.lang.String getFrom()
@Nonnull public MailMessage setReplyTo(@Nonnull java.lang.String replyTo) throws InvalidDataException
replyTo - - email address to the reply should be sent toInvalidDataException@CheckReturnValue @Nullable public java.lang.String getReplyTo()
@CheckReturnValue @Nullable public java.lang.String getCalcReplyTo()
@Nonnull public MailMessage clearRecipients()
@Nonnull public MailMessage addRecipient(@Nonnull java.lang.String type, @Nonnull java.lang.String recipient) throws InvalidDataException
type - TO, CC, BCCrecipient - - email address of recipientInvalidDataException@Nonnull public MailMessage addRecipients(@Nonnull java.lang.String type, @Nullable java.lang.String[] recipients) throws InvalidDataException
type - TO, CC, BCCrecipients - - list of recipient email addressesInvalidDataException@Nonnull public MailMessage addRecipient(@Nonnull java.lang.String recipient) throws InvalidDataException
recipient - - the email address of the recipientInvalidDataException@CheckReturnValue @Nonnull public java.lang.String[] getRecipients()
@Nonnull public MailMessage addCC(@Nonnull java.lang.String recipient) throws InvalidDataException
recipient - StringInvalidDataException@Nonnull public MailMessage addBCC(@Nonnull java.lang.String recipient) throws InvalidDataException
recipient - - the email address of the recipient to be added to BCC listInvalidDataException@Nonnull public MailMessage setReadReceipt(boolean flag)
flag - - if true then the read receipt will be activated@Nonnull public MailMessage setEmbedRemoteImages(boolean flag)
flag - true to embed remote images.@CheckReturnValue public boolean getReadReceipt()
@Nonnull public MailMessage setServerReceipt(boolean flag)
flag - - if true then the server receipt will be activated@CheckReturnValue public boolean getServerReceipt()
@Nonnull public MailMessage setHeader(@Nonnull java.lang.String key, @Nonnull java.lang.String value)
key - - the key of the headervalue - - the value of the header@Nonnull public MailAttachment addAttachment(@Nonnull DBFile file, @Nullable java.lang.String attachmentName) throws java.lang.Exception
file - the DBFile to be addedattachmentName - - the attachmentName to overwrite file name when sendingjava.lang.Exception - a serious problem.@Nonnull public MailAttachment addAttachment(@Nonnull MailAttachment ma) throws java.lang.Exception
ma - the attachmentjava.lang.Exception - a serious problem.@Nonnull public MailAttachment addAttachment(@Nonnull java.io.File file, @Nullable java.lang.String attachmentName) throws java.lang.Exception
file - the File to be addedattachmentName - - the attachmentName to overwrite file name when sendingjava.lang.Exception - a serious problem.@CheckReturnValue @Nonnull public MailAttachment[] listAttachments()
@CheckReturnValue
 @Nonnull
public MimeMessage getMessage()
                                                   throws java.lang.Exception
java.lang.Exception - a serious problempublic void send()
          throws java.lang.Exception
java.lang.Exception - a serious problem@CheckReturnValue
 @Nonnull
public java.lang.String generateMimeBody()
                                                              throws java.lang.Exception
java.lang.Exception - a serious problem.@CheckReturnValue
 @Nonnull
public java.lang.String makeHTML()
                                                      throws java.lang.Exception
java.lang.Exception@CheckReturnValue
 @Nonnull
protected MimeMessage constructMessage(@Nonnull
                                                                   Session session)
                                                            throws java.lang.Exception
session - - the current SMTP sessionjava.lang.Exception - a serious problem@Nullable
protected MimeMultipart addAttachments(MimeMultipart mp,
                                                 java.lang.String sendHTML)
                                          throws java.lang.Exception
mp - - the multi part object to add the embed attachments to if not other attachmentssendHTML - the HTML that is being sentjava.lang.Exception - a serious problemstSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.