Class MailResources

java.lang.Object
de.aikiit.mailversendala.template.MailResources

public final class MailResources extends Object
Validates and snapshots local mail resources once per run. No network resolver is used. Files are kept in memory so later filesystem changes cannot change a validated message.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MailResources(MailConfig configuration)
    Load configured, comma-separated attachments relative to the real template directory.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    applyTo(org.apache.commons.mail2.jakarta.HtmlEmail email, MailTemplate template)
    Embed local images using Content-IDs and add ordinary downloadable attachments.
    void
    Validate every inline image in a rendered message before the first delivery.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MailResources

      public MailResources(MailConfig configuration) throws IOException
      Load configured, comma-separated attachments relative to the real template directory.
      Parameters:
      configuration - template directory and attachment references.
      Throws:
      IOException - if a configured file is inaccessible or outside the directory.
  • Method Details

    • validate

      public void validate(MailTemplate template) throws IOException
      Validate every inline image in a rendered message before the first delivery.
      Parameters:
      template - rendered message bodies.
      Throws:
      IOException - for missing, external, unsupported or escaping image references.
    • applyTo

      public void applyTo(org.apache.commons.mail2.jakarta.HtmlEmail email, MailTemplate template) throws org.apache.commons.mail2.core.EmailException
      Embed local images using Content-IDs and add ordinary downloadable attachments.
      Parameters:
      email - configured outgoing message.
      template - rendered HTML and plain-text alternatives.
      Throws:
      org.apache.commons.mail2.core.EmailException - if resource validation or MIME construction fails.