Class AbstractBaseMail

java.lang.Object
ch.tocco.nice2.messaging.mail.spi.AbstractBaseMail
All Implemented Interfaces:
BaseMail
Direct Known Subclasses:
AbstractOutgoingMail, IncomeMailImpl

public abstract class AbstractBaseMail extends Object implements BaseMail
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected List<Attachment>
     
    protected List<jakarta.mail.internet.InternetAddress>
     
    protected List<jakarta.mail.internet.InternetAddress>
     
    protected jakarta.mail.internet.InternetAddress
     
    protected String
     
    protected final org.slf4j.Logger
     
    protected List<jakarta.mail.internet.InternetAddress>
     
    protected String
     
    protected String
     
    protected List<jakarta.mail.internet.InternetAddress>
     

    Fields inherited from interface ch.tocco.nice2.messaging.mail.api.BaseMail

    NO_SUBJECT
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractBaseMail(org.slf4j.Logger log)
     
    protected
    AbstractBaseMail(org.slf4j.Logger log, String subject)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    addBcc(jakarta.mail.internet.InternetAddress address)
     
    void
    addBcc(String addresses)
    Add addresses from a String to "bcc".
    Can be either only email or email and name in format: "firstname lastname <email>.
    example: "Hans Meier <hmeier@tocco.ch>"
    void
    addBcc(List<String> addresses)
    Add addresses from a List<String> to "bcc".
    Can be either only email or email and name in format: "firstname lastname <email>.
    example: "Hans Meier <hmeier@tocco.ch>"
    void
    addCc(jakarta.mail.internet.InternetAddress address)
     
    void
    addCc(String addresses)
    Add addresses from a String to "cc".
    Can be either only email or email and name in format: "firstname lastname <email>.
    example: "Hans Meier <hmeier@tocco.ch>"
    void
    addCc(List<String> addresses)
    Add addresses from a List to "cc".
    Can be either only email or email and name in format: "firstname lastname <email>.
    example: "Hans Meier <hmeier@tocco.ch>"
    void
    addReplyTo(jakarta.mail.internet.InternetAddress address)
     
    void
    addReplyTo(String addresses)
    Add addresses from a String to "replyTo".
    Can be either only email or email and name in format: "firstname lastname <email>.
    example: "Hans Meier <hmeier@tocco.ch>"
    void
    addReplyTo(List<String> addresses)
    Add addresses from a List<String> to "replyTo".
    Can be either only email or email and name in format: "firstname lastname <email>.
    example: "Hans Meier <hmeier@tocco.ch>"
    void
    addTo(jakarta.mail.internet.InternetAddress address)
     
    void
    addTo(String addresses)
    Add addresses from a String to "to".
    Can be either only email or email and name in format: "firstname lastname <email>.
    example: "Hans Meier <hmeier@tocco.ch>" This is only necessary if no recipient entity is set or if you want to add further addresses
    void
    addTo(List<String> addresses)
    Add addresses from a List<String> to "to".
    Can be either only email or email and name in format: "firstname lastname <email>.
    example: "Hans Meier <hmeier@tocco.ch>" This is only necessary if no recipient entity is set or if you want to add further addresses
    void
     
    void
     
    void
     
    void
     
    void
     
    boolean
     
    createAttachment(jakarta.activation.MimeType mimeType)
     
    createAttachment(@Nullable String id, jakarta.activation.MimeType mimeType)
     
    createAttachment(@Nullable String id, @Nullable String fileName, Binary binary)
    Adds the given attachment to this mail.
     
    List<jakarta.mail.internet.InternetAddress>
     
    List<jakarta.mail.internet.InternetAddress>
     
    jakarta.mail.internet.InternetAddress
     
     
    List<jakarta.mail.internet.InternetAddress>
     
     
     
    List<jakarta.mail.internet.InternetAddress>
     
    void
     
    boolean
     
    void
    setBcc(Iterable<jakarta.mail.internet.InternetAddress> addresses)
     
    void
    setCc(Iterable<jakarta.mail.internet.InternetAddress> addresses)
     
    void
    setFrom(jakarta.mail.internet.InternetAddress from)
     
    void
     
    void
    setReplyTo(Iterable<jakarta.mail.internet.InternetAddress> addresses)
     
    void
    setSubject(String subject)
     
    void
     
    void
    setTo(Iterable<jakarta.mail.internet.InternetAddress> addresses)
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • log

      protected final org.slf4j.Logger log
    • subject

      protected String subject
    • from

      protected jakarta.mail.internet.InternetAddress from
    • to

      protected List<jakarta.mail.internet.InternetAddress> to
    • cc

      protected List<jakarta.mail.internet.InternetAddress> cc
    • bcc

      protected List<jakarta.mail.internet.InternetAddress> bcc
    • replyTo

      protected List<jakarta.mail.internet.InternetAddress> replyTo
    • text

      protected String text
    • html

      protected String html
    • attachments

      protected List<Attachment> attachments
  • Constructor Details

    • AbstractBaseMail

      protected AbstractBaseMail(org.slf4j.Logger log, String subject)
    • AbstractBaseMail

      protected AbstractBaseMail(org.slf4j.Logger log)
  • Method Details

    • getSubject

      public String getSubject()
      Specified by:
      getSubject in interface BaseMail
    • getFrom

      public jakarta.mail.internet.InternetAddress getFrom()
      Specified by:
      getFrom in interface BaseMail
    • getTo

      public List<jakarta.mail.internet.InternetAddress> getTo()
      Specified by:
      getTo in interface BaseMail
    • getCc

      public List<jakarta.mail.internet.InternetAddress> getCc()
      Specified by:
      getCc in interface BaseMail
    • getBcc

      public List<jakarta.mail.internet.InternetAddress> getBcc()
      Specified by:
      getBcc in interface BaseMail
    • getReplyTo

      public List<jakarta.mail.internet.InternetAddress> getReplyTo()
      Specified by:
      getReplyTo in interface BaseMail
    • getText

      public String getText()
      Specified by:
      getText in interface BaseMail
    • getHtml

      public String getHtml()
      Specified by:
      getHtml in interface BaseMail
    • setSubject

      public void setSubject(String subject)
      Specified by:
      setSubject in interface BaseMail
    • setFrom

      public void setFrom(jakarta.mail.internet.InternetAddress from)
      Specified by:
      setFrom in interface BaseMail
    • addTo

      public void addTo(jakarta.mail.internet.InternetAddress address)
      Specified by:
      addTo in interface BaseMail
    • addTo

      public void addTo(List<String> addresses)
      Description copied from interface: BaseMail
      Add addresses from a List<String> to "to".
      Can be either only email or email and name in format: "firstname lastname <email>.
      example: "Hans Meier <hmeier@tocco.ch>" This is only necessary if no recipient entity is set or if you want to add further addresses
      Specified by:
      addTo in interface BaseMail
      Parameters:
      addresses - List
    • addTo

      public void addTo(String addresses)
      Description copied from interface: BaseMail
      Add addresses from a String to "to".
      Can be either only email or email and name in format: "firstname lastname <email>.
      example: "Hans Meier <hmeier@tocco.ch>" This is only necessary if no recipient entity is set or if you want to add further addresses
      Specified by:
      addTo in interface BaseMail
      Parameters:
      addresses - String separated with "," or "\n"
    • clearTo

      public void clearTo()
      Specified by:
      clearTo in interface BaseMail
    • setTo

      public void setTo(Iterable<jakarta.mail.internet.InternetAddress> addresses)
    • addCc

      public void addCc(jakarta.mail.internet.InternetAddress address)
      Specified by:
      addCc in interface BaseMail
    • addCc

      public void addCc(List<String> addresses)
      Description copied from interface: BaseMail
      Add addresses from a List to "cc".
      Can be either only email or email and name in format: "firstname lastname <email>.
      example: "Hans Meier <hmeier@tocco.ch>"
      Specified by:
      addCc in interface BaseMail
      Parameters:
      addresses - List
    • addCc

      public void addCc(String addresses)
      Description copied from interface: BaseMail
      Add addresses from a String to "cc".
      Can be either only email or email and name in format: "firstname lastname <email>.
      example: "Hans Meier <hmeier@tocco.ch>"
      Specified by:
      addCc in interface BaseMail
      Parameters:
      addresses - String separated with "," or "\n"
    • clearCc

      public void clearCc()
      Specified by:
      clearCc in interface BaseMail
    • setCc

      public void setCc(Iterable<jakarta.mail.internet.InternetAddress> addresses)
    • addBcc

      public void addBcc(jakarta.mail.internet.InternetAddress address)
      Specified by:
      addBcc in interface BaseMail
    • addBcc

      public void addBcc(List<String> addresses)
      Description copied from interface: BaseMail
      Add addresses from a List<String> to "bcc".
      Can be either only email or email and name in format: "firstname lastname <email>.
      example: "Hans Meier <hmeier@tocco.ch>"
      Specified by:
      addBcc in interface BaseMail
      Parameters:
      addresses - List
    • addBcc

      public void addBcc(String addresses)
      Description copied from interface: BaseMail
      Add addresses from a String to "bcc".
      Can be either only email or email and name in format: "firstname lastname <email>.
      example: "Hans Meier <hmeier@tocco.ch>"
      Specified by:
      addBcc in interface BaseMail
      Parameters:
      addresses - String separated with "," or "\n"
    • clearBcc

      public void clearBcc()
      Specified by:
      clearBcc in interface BaseMail
    • setBcc

      public void setBcc(Iterable<jakarta.mail.internet.InternetAddress> addresses)
    • addReplyTo

      public void addReplyTo(jakarta.mail.internet.InternetAddress address)
      Specified by:
      addReplyTo in interface BaseMail
    • addReplyTo

      public void addReplyTo(List<String> addresses)
      Description copied from interface: BaseMail
      Add addresses from a List<String> to "replyTo".
      Can be either only email or email and name in format: "firstname lastname <email>.
      example: "Hans Meier <hmeier@tocco.ch>"
      Specified by:
      addReplyTo in interface BaseMail
      Parameters:
      addresses - List
    • addReplyTo

      public void addReplyTo(String addresses)
      Description copied from interface: BaseMail
      Add addresses from a String to "replyTo".
      Can be either only email or email and name in format: "firstname lastname <email>.
      example: "Hans Meier <hmeier@tocco.ch>"
      Specified by:
      addReplyTo in interface BaseMail
      Parameters:
      addresses - String separated with "," or "\n"
    • clearReplyTo

      public void clearReplyTo()
      Specified by:
      clearReplyTo in interface BaseMail
    • setReplyTo

      public void setReplyTo(Iterable<jakarta.mail.internet.InternetAddress> addresses)
    • setText

      public void setText(String text)
      Specified by:
      setText in interface BaseMail
    • setHtml

      public void setHtml(String html)
      Specified by:
      setHtml in interface BaseMail
    • mergeWithExistingHtml

      public void mergeWithExistingHtml(String htmlToMerge)
    • createAttachment

      public Attachment createAttachment(@Nullable @Nullable String id, @Nullable @Nullable String fileName, Binary binary)
      Description copied from interface: BaseMail
      Adds the given attachment to this mail. The content is taken from the given binary. The returned attachment is restricted in that it is not allowed to load new content using methods Attachment.setContent(byte[]),Attachment.loadContent(java.io.InputStream) or Attachment.setMimeType(MimeType) for setting the mime type
      Specified by:
      createAttachment in interface BaseMail
      Parameters:
      id - optional id for this attachment
      fileName - optional name for this attachment
      binary - the content
    • createAttachment

      public Attachment createAttachment(jakarta.activation.MimeType mimeType)
      Specified by:
      createAttachment in interface BaseMail
    • createAttachment

      public Attachment createAttachment(@Nullable @Nullable String id, jakarta.activation.MimeType mimeType)
      Specified by:
      createAttachment in interface BaseMail
    • addAttachment

      public void addAttachment(Attachment attachment)
      Specified by:
      addAttachment in interface BaseMail
    • removeAttachment

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

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

      public List<Attachment> getAttachments()
      Specified by:
      getAttachments in interface BaseMail
    • clearAttachments

      public void clearAttachments()
      Specified by:
      clearAttachments in interface BaseMail
    • toString

      public String toString()
      Overrides:
      toString in class Object