Interface IMailContext

All Known Implementing Classes:
DefaultMailContext, MSGraphMailContext, PasswordMailContext

public interface IMailContext
A mail context that can send emails. Implementations may employ different methods of sending the mail, such as via an SMTP server or via a REST API.
  • Method Details

    • archive

      void archive(IBaseMailData mail, Mandant client, File file) throws Exception
      Create an archived file of the mail.
      Parameters:
      mail - Data of the email to send.
      client - The client to use for placeholder replacements.
      file - The file to write to.
      Throws:
      Exception - When the archive file could not be created.
    • getServerData

      IMailServerData getServerData()
      Gets the mail server data of the context
      Returns:
      the server data
    • send

      default void send(IBaseMailData mail) throws Exception
      Sends an mail based on the given data
      Parameters:
      mail - Data with the mail or mails to sent.
      Throws:
      Exception - When the mail could not be sent, e.g. due to network errors or invalid mail addresses.
    • send

      default void send(IBaseMailData mail, Mandant client) throws Exception
      Sends a mail based on the given data
      Parameters:
      mail - Data with the mail or mails to sent.
      client - The client scope to use for placeholder replacements
      Throws:
      Exception - When the mail could not be sent, e.g. due to network errors or invalid mail addresses.
    • sendWithReport

      ISendMailReport sendWithReport(IBaseMailData mail) throws Exception
      Sends a mail based on the given data
      Parameters:
      mail - Data with the mail or mails to sent.
      Returns:
      Information about the mails that were actually sent.
      Throws:
      Exception - When the mail could not be sent, e.g. due to network errors or invalid mail addresses.
    • sendWithReport

      ISendMailReport sendWithReport(IBaseMailData mail, Mandant client) throws Exception
      Sends a mail based on the given data
      Parameters:
      mail - Data with the mail or mails to sent.
      client - The client scope to use for placeholder replacements
      Returns:
      Information about the mails that were actually sent.
      Throws:
      Exception - When the mail could not be sent, e.g. due to network errors or invalid mail addresses.
    • setAddressFilter

      @Deprecated default void setAddressFilter(de.xima.cmn.filter.IGenericFilter<javax.mail.Address> addressFilter)
      Deprecated.
      Sets an filter for excluding mail addresses during send
      Parameters:
      addressFilter - the address filter to set
    • setAddressFilter

      void setAddressFilter(Predicate<javax.mail.Address> addressFilter)
      Sets an filter for excluding mail addresses during send
      Parameters:
      addressFilter - the address filter to set
      Since:
      8.0.0