Class ResponseGenerator

java.lang.Object
org.shredzone.acme4j.smime.email.ResponseGenerator

public class ResponseGenerator extends Object
A helper for creating an email response to the "challenge" email.

According to RFC-8823, the response email must be DKIM signed. This is not done by the response generator, but must be done by the outbound MTA.

Since:
2.12
See Also:
  • Constructor Details

  • Method Details

    • withHeader

      public ResponseGenerator withHeader(@Nullable String header)
      Adds a custom header to the response mail body.

      There is no need to set a header, since the response email is usually not read by humans. If a header is set, it must contain ASCII encoded plain text.

      Parameters:
      header - Header text to be used, or null if no header is to be used.
      Returns:
      itself
    • withFooter

      public ResponseGenerator withFooter(@Nullable String footer)
      Adds a custom footer to the response mail body.

      There is no need to set a footer, since the response email is usually not read by humans. If a footer is set, it must contain ASCII encoded plain text.

      Parameters:
      footer - Footer text to be used, or null if no footer is to be used.
      Returns:
      itself
    • withGenerator

      Sets a ResponseBodyGenerator that is used for generating a response body.

      Use this generator to individually style the email body, for example to use a multipart body. However be aware that the response mail is evaluated by a machine, and usually not read by humans, so the body should be designed as simple as possible.

      The default body generator will just concatenate the header, the armored key authorization body, and the footer.

      Parameters:
      generator - ResponseBodyGenerator to be used, or null to use the default one.
      Returns:
      itself
    • generateResponse

      public jakarta.mail.Message generateResponse(jakarta.mail.Session session) throws jakarta.mail.MessagingException
      Generates the response email.

      Note that according to RFC-8823, this message must have a valid DKIM or S/MIME signature. This is not done here, but usually performed by the outbound MTA.

      Parameters:
      session - javax.mail Session to be used for this mail.
      Returns:
      Generated Message.
      Throws:
      jakarta.mail.MessagingException