Interface EmailResource


public interface EmailResource
The EmailResource interface represents a single email message to be sent using one of the sendmail() methods.

Further documentation.

Since:
V4.4
  • Method Summary

    Modifier and Type Method Description
    boolean sendmail()
    Sends the email message as specified in the email resource.
    boolean sendmail​(java.lang.String[] attachmentFilePaths)
    Sends the email message as specified in the email resource together with any attachments.
    boolean sendmail​(java.lang.String[] attachmentFilePaths, java.util.Map<java.lang.String,​java.lang.String> attachmentTexts)
    Sends the email message as specified in the email resource together with any attachments.
  • Method Details

    • sendmail

      boolean sendmail() throws com.ebasetech.xi.exceptions.FormRuntimeException
      Sends the email message as specified in the email resource. Any substitutable fields in the email resource are replaced with values from mapped form fields.

      If a failure occurs, behaviour depends on the setting of the Success of this Email is critical checkbox in the email resource:

      • checked - a FormException is thrown
      • unchecked - returns false
      Further documentation.
      Returns:
      false if there is a failure and the email resource is not marked as critical (see above), otherwise returns true.
      Throws:
      com.ebasetech.xi.exceptions.FormRuntimeException - if any error occurs during execution and the email resource is marked as critical (see above)
      Since:
      V4.4
      See Also:
      sendmail(String[]), sendmail(String[], Map)
    • sendmail

      boolean sendmail​(java.lang.String[] attachmentFilePaths) throws com.ebasetech.xi.exceptions.FormRuntimeException
      Sends the email message as specified in the email resource together with any attachments. Any substitutable fields in the email resource are replaced with values from mapped form fields.

      If a failure occurs, behaviour depends on the setting of the Success of this Email is critical checkbox in the email resource:

      • checked - a FormException is thrown
      • unchecked - returns false
      This method supports file attachments. Parameter attachmentFilePaths is an array that specifies a number of file paths for files to be attached to the email.

      Further documentation.

      Javascript example:

       var fileAttachments = [ fields.FILE1.value, fields.FILE2.value ];
       var emailOk = resources.EM1.sendmail(fileAttachments);
       if (!emailOk)
        ....
       
      Parameters:
      attachmentFilePaths - an array of file paths for files to be attached to the email
      Returns:
      false if there is a failure and the email resource is not marked as critical (see above), otherwise returns true.
      Throws:
      com.ebasetech.xi.exceptions.FormRuntimeException - if any error occurs during execution and the email resource is marked as critical (see above)
      Since:
      V4.4
      See Also:
      sendmail(), sendmail(String[], Map)
    • sendmail

      boolean sendmail​(java.lang.String[] attachmentFilePaths, java.util.Map<java.lang.String,​java.lang.String> attachmentTexts) throws com.ebasetech.xi.exceptions.FormRuntimeException
      Sends the email message as specified in the email resource together with any attachments. Any substitutable fields in the email resource are replaced with values from mapped form fields.

      If a failure occurs, behaviour depends on the setting of the Success of this Email is critical checkbox in the email resource:

      • checked - a FormException is thrown
      • unchecked - returns false
      Attachments can be added to the email if two ways:
      • As files. Parameter attachmentFilePaths is an array that specifies a number of file paths for files to be attached to the email.
      • As strings. Parameter attachmentTexts is a Map that provides a way of specifying attachments using strings. Map keys are treated as attachment names and the corresponding values form the attachments.
      Further documentation.

      Javascript example 1 (inline attachment):

       var inlineAttachments = {};
       inlineAttachments.attachment1Name = "This is an email attachment";
       resources.EM1.sendmail(null, inlineAttachments);
       

      Javascript example 2 (inline and file attachments):

       var inlineAttachments = {};
       inlineAttachments.attachment1Name = "This is an email attachment";
       var fileAttachments = [ fields.FILE1.value, fields.FILE2.value ];
       resources.EM1.sendmail(fileAttachments, inlineAttachments);
       
      Parameters:
      attachmentFilePaths - an array of file paths for files to be attached to the email
      attachmentTexts - a Map specifying inline (String) attachments, see above
      Returns:
      false if there is a failure and the email resource is not marked as critical (see above), otherwise returns true.
      Throws:
      com.ebasetech.xi.exceptions.FormRuntimeException - if any error occurs during execution and the email resource is marked as critical (see above)
      Since:
      V4.4
      See Also:
      sendmail(), sendmail(String[])