Interface Mail

All Superinterfaces:
BaseMail, Cloneable
All Known Implementing Classes:
AbstractOutgoingMail, DelegatingMail, IncaIncomeMail, IncaMail, MailImpl

public interface Mail extends BaseMail, Cloneable
  • Method Details

    • getSourceEntity

      @Nullable @Nullable Entity getSourceEntity()
    • setSourceEntity

      Mail setSourceEntity(@Nullable @Nullable Entity sourceEntity)
    • addSourceEntity

      Mail addSourceEntity(@Nullable @Nullable Entity sourceEntity)
    • getRelatedEntity

      @Nullable @Nullable Entity getRelatedEntity()
    • setRelatedEntity

      Mail setRelatedEntity(@Nullable @Nullable Entity relatedEntity)
    • getRecipientEntity

      @Nullable @Nullable Entity getRecipientEntity()
    • setRecipientEntity

      Mail setRecipientEntity(@Nullable @Nullable Entity recipientEntity)
    • addTo

      Mail addTo(MailReceiver receiver) throws javax.mail.MessagingException
      Add a receiver to "to", evaluating the right value according to the MailReceiver^s configuration.
      Parameters:
      receiver - the receiver
      Throws:
      javax.mail.MessagingException
    • addTo

      Mail addTo(Entity userEntity) throws javax.mail.MessagingException
      Add the address from a User entity to "to".
      Parameters:
      userEntity - Entity of type User
      Throws:
      javax.mail.MessagingException
    • addTo

      Mail addTo(EntityList userEntities) throws javax.mail.MessagingException
      Add addresses from User entities to "to".
      Parameters:
      userEntities - EntityList with entities of type User
      Throws:
      javax.mail.MessagingException
    • addCc

      Mail addCc(Entity userEntity) throws javax.mail.MessagingException
      Add the address from a User entity to "cc".
      Parameters:
      userEntity - Entity of type User
      Throws:
      javax.mail.MessagingException
    • addCc

      Mail addCc(EntityList userEntities) throws javax.mail.MessagingException
      Add addresses from User entities to "cc".
      Parameters:
      userEntities - EntityList with entities of type User
      Throws:
      javax.mail.MessagingException
    • addBcc

      Mail addBcc(Entity userEntity) throws javax.mail.MessagingException
      Add the address from a User entity to "bcc".
      Parameters:
      userEntity - Entity of type User
      Throws:
      javax.mail.MessagingException
    • addBcc

      Mail addBcc(EntityList userEntities) throws javax.mail.MessagingException
      Add addresses from User entities to "bcc".
      Parameters:
      userEntities - EntityList with entities of type User
      Throws:
      javax.mail.MessagingException
    • getContactCategory

      @Nullable @Nullable Entity getContactCategory()
    • setContactCategory

      Mail setContactCategory(@Nullable @Nullable Entity contactCategory)
    • getTemplateEntity

      @Nullable @Nullable Entity getTemplateEntity()
    • setTemplateEntity

      Mail setTemplateEntity(@Nullable @Nullable Entity templateEntity)
    • preventFromArchive

      Mail preventFromArchive(boolean preventFromArchive)
    • setTemplateAttribute

      Mail setTemplateAttribute(String name, Object value)
      Set a template attribute. If an attribute with the same name already exists it will be overriden. To set entity data into a variable use setTemplateEntityData(String, ch.tocco.nice2.persist.entity.Entity) and setTemplateEntityListData(String, ch.tocco.nice2.persist.entity.EntityList).
      Parameters:
      name - The name for the attribute.
      value - The value.
    • setTemplateEntityData

      Mail setTemplateEntityData(String name, Entity entity)
      Set an entity template attribute
      Parameters:
      name - the name for the attribute
      entity - the entity
    • setTemplateEntityListData

      Mail setTemplateEntityListData(String name, EntityList entityList)
      Set an entity list template attribute
      Parameters:
      name - the name for the attribute
      entityList - the entity list
    • getTemplateAttribute

      Optional<Object> getTemplateAttribute(String name)
      Get the value of a template attribute.
      Parameters:
      name - The name of the attribute to get.
      Returns:
      the value or Optional.empty() if it's not set.
    • getTemplateAttributes

      Map<String,Object> getTemplateAttributes()
      Get an unmodifiable map of all template attributes.
      Returns:
      an unmodifiable map of all attributes.
    • removeAttachment

      boolean removeAttachment(Attachment attachment)
      Specified by:
      removeAttachment in interface BaseMail
    • containsAttachment

      boolean containsAttachment(Attachment attachment)
      Specified by:
      containsAttachment in interface BaseMail
    • getAttributes

      Map<String,Object> getAttributes()
    • send

      void send() throws MailException
      Send the message.
      Throws:
      MailException
    • clone

      Throws:
      CloneNotSupportedException
    • setFrom

      Mail setFrom(Entity from) throws javax.mail.MessagingException
      Throws:
      javax.mail.MessagingException
    • getSender

      Entity getSender()
    • setSender

      Mail setSender(Entity sender)
    • setSingleCopyMail

      Mail setSingleCopyMail(boolean singleCopyMail)
      only relevant for the GUI MailAction (defaults to false), won't link the resulting MailArchive entity to the recipient but the User(s) with the email address in BaseMail.getCc().
      Parameters:
      singleCopyMail - true / false
    • isSingleCopyMail

      boolean isSingleCopyMail()
    • getExpiryDate

      org.joda.time.LocalDate getExpiryDate()
    • setExpiryDate

      Mail setExpiryDate(org.joda.time.LocalDate expiryDate)
    • getTaskUuid

      UUID getTaskUuid()
    • setTaskUuid

      Mail setTaskUuid(UUID taskUuid)
      Set the UUID which is needed to group the mails sent from the same task
      Parameters:
      taskUuid - a random uuid given from the task which sends the mail
    • getBody

      String getBody() throws MailException
      Throws:
      MailException
    • getMimeMessageHeaders

      Map<String,Iterable<String>> getMimeMessageHeaders() throws MailException, javax.mail.MessagingException
      Throws:
      MailException
      javax.mail.MessagingException
    • getMimeMessageFrom

      String getMimeMessageFrom() throws javax.mail.MessagingException, MailException
      Throws:
      javax.mail.MessagingException
      MailException
    • addMailListener

      void addMailListener(Mail.MailListener listener)
    • removeMailListener

      void removeMailListener(Mail.MailListener listener)