Class GroovyMailBuilderWrapper

java.lang.Object
de.uplanet.lucy.server.mail.GroovyMailBuilderWrapper

public final class GroovyMailBuilderWrapper extends Object
  • Method Details

    • setUseTransaction

      public void setUseTransaction(boolean p_bUseTransaction)
      This flag indicates if mail sending (@link #drop() drop}) should be part of the current transaction if one exists.

      Normally this is true by default.

      Parameters:
      p_bUseTransaction - true if a transaction should be used, or false otherwise.
    • isUseTransaction

      public boolean isUseTransaction()
      This flag indicates if mail sending (@link #drop() drop}) should be part of the current transaction if one exists.

      Normally this is true by default.

      Returns:
      true if a transaction should be used, or false otherwise.
    • getDirOutput

      public File getDirOutput()
      Set the (temporary) output directory for mail drop operations.

      This directory should reside on the same physical device as the output directory.

      Returns:
      The output directory.
    • setDirOutput

      public void setDirOutput(File p_dirOutput)
      Set the (temporary) output directory for mail drop operations.

      This directory should reside on the same physical device as the pickup directory.

      Parameters:
      p_dirOutput - The output directory.
    • getDirPickup

      public File getDirPickup()
      Get the pickup directory for mail drop operations.

      This directory should reside on the same physical device as the output directory.

      Returns:
      The pickup directory.
    • setDirPickup

      public void setDirPickup(File p_dirPickup)
      Set the pickup directory for mail drop operations.

      This directory should reside on the same physical device as the output directory.

      Parameters:
      p_dirPickup - The pickup directory.
    • setHeaders

      public void setHeaders(Map<String,String> p_headers)
      Add the mail headers from the given map.
      Parameters:
      p_headers - A map that contains the mail headers to be added.
    • addHeader

      public void addHeader(String p_strName, String p_strValue)
      Add a mail header.
      Parameters:
      p_strName - The header name.
      p_strValue - The header value.
    • setFrom

      public void setFrom(Object p_address)
      Set the From address.
      Parameters:
      p_address - A character sequence, or a InternetAddress.
    • setTo

      public void setTo(Object p_addresses)
      Set one or more To recipient sddresses.
      Parameters:
      p_addresses - An address, or a collection of addresses.
      • Adresses can be character sequences (strings), or of the type InternetAddress.
      • Address collections can be of the type Collection, or one of its subtypes such as lists, or sets. Arrays are also supported. The contained elements must be of the same types as single addresses.
    • addTo

      public void addTo(Object p_address)
      Add a To recipient address.
      Parameters:
      p_address - A character sequence, or a InternetAddress.
    • setCc

      public void setCc(Object p_addresses)
      Set one or more Cc recipient sddresses.
      Parameters:
      p_addresses - An address, or a collection of addresses.
      • Adresses can be character sequences (strings), or of the type InternetAddress.
      • Address collections can be of the type Collection, or one of its subtypes such as lists, or sets. Arrays are also supported. The contained elements must be of the same types as single addresses.
    • addCc

      public void addCc(Object p_address)
      Add a Cc recipient address.
      Parameters:
      p_address - A character sequence, or a InternetAddress.
    • setBcc

      public void setBcc(Object p_addresses)
      Set one or more Bcc recipient sddresses.
      Parameters:
      p_addresses - An address, or a collection of addresses.
      • Adresses can be character sequences (strings), or of the type InternetAddress.
      • Address collections can be of the type Collection, or one of its subtypes such as lists, or sets. Arrays are also supported. The contained elements must be of the same types as single addresses.
    • addBcc

      public void addBcc(Object p_address)
      Add a Bcc recipient address.
      Parameters:
      p_address - A character sequence, or a InternetAddress.
    • setReplyTo

      public void setReplyTo(Object p_addresses)
      Set one or more Reply-To sddresses.
      Parameters:
      p_addresses - An address, or a collection of addresses.
      • Adresses can be character sequences (strings), or of the type InternetAddress.
      • Address collections can be of the type Collection, or one of its subtypes such as lists, or sets. Arrays are also supported. The contained elements must be of the same types as single addresses.
    • addReplyTo

      public void addReplyTo(Object p_address)
      Add a Reply-To address.
      Parameters:
      p_address - A character sequence, or a InternetAddress.
    • getSubject

      public String getSubject()
      Get the subject.
      Returns:
      The subject.
    • setSubject

      public void setSubject(String p_strSubject)
      Set the subject.
      Parameters:
      p_strSubject - The subject.
    • getBody

      public de.uplanet.lucy.server.mail.GroovyMailBuilderWrapper.BodyWrapper getBody()
      Get the mail body object.
      Returns:
      The mail body object.
    • setBody

      public void setBody(CharSequence p_chseq)
      Set the mail body as text.
      Parameters:
      p_chseq - The mail body content as text.
    • getContentType

      public String getContentType()
      Get the content type of this mail.

      Default is text/plain.

      Returns:
      The content type.
    • setContentType

      public void setContentType(String p_strContentType)
      Set the content type of this mail.

      Default is text/plain.

      Parameters:
      p_strContentType - The content type.
    • attachFile

      public void attachFile(Map<String,Object> p_namedArgs)
      Attach a file to this message.

      Parameters are

      • file: the file to be attached, as a file object, or path (required)
      • contentType: the content type of the file (required)
      • name: the attachment's file name; if omitted, the name of file will be used

      Parameters:
      p_namedArgs - The named parameters.
    • attachFile

      public void attachFile(Object p_obj, String p_strContentType, String p_strName)
      Attach a file to this message.
      Parameters:
      p_obj - The file as a file object, or path.
      p_strContentType - The content type.
      p_strName - The attachment's file name.
    • attachFileRelated

      public void attachFileRelated(Map<String,Object> p_namedArgs)
      Attach a file to this message. This method is primarily used to attach inline images of HTML mails.

      Parameters are

      • file: the file to be attached, as a file object, or path (required)
      • contentType: the content type of the file (required)
      • name: the attachment's file name; if omitted, the name of file will be used
      • contentId: the attachment's Content-ID

      Parameters:
      p_namedArgs - The named parameters.
    • attachFileRelated

      public void attachFileRelated(Object p_obj, String p_strContentType, String p_strName, String p_strContentId)
      Attach a file to this message.
      Parameters:
      p_obj - The file as a file object, or path.
      p_strContentType - The content type.
      p_strName - The attachment's file name.
      p_strContentId - The attachment's Content-ID.
    • srcInlineImage

      public String srcInlineImage(Object p_obj)
      Add an inline image to this message.

      The content type is derived from the extension of the given file. Supported extensions are .png, .jpg, .jpeg, .jpe, .gif, .tif, .tiff, and .bmp.

      Parameters:
      p_obj - The inline image as a file object, or path.
      Returns:
      The generated Content-ID of the file.
    • srcInlineImage

      public String srcInlineImage(Object p_obj, String p_strContentType)
      Add an inline image to this message.
      Parameters:
      p_obj - The inline image as a file object, or path.
      p_strContentType - The content type of the image.
      Returns:
      The generated Content-ID of the file.
    • drop

      public File drop() throws javax.mail.MessagingException, IOException
      Drop the mail as a file in the pickup folder.
      Returns:
      The dropped file.
      Throws:
      javax.mail.MessagingException
      IOException
    • send

      public void send(Map<String,Object> p_namedArgs) throws javax.mail.MessagingException, IOException
      Throws:
      javax.mail.MessagingException
      IOException
    • send

      public void send(javax.mail.Session p_session) throws javax.mail.MessagingException, IOException
      Throws:
      javax.mail.MessagingException
      IOException