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 Summary
ConstructorsConstructorDescriptionResponseGenerator(EmailProcessor processor) Creates a newResponseGenerator. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.mail.MessagegenerateResponse(jakarta.mail.Session session) Generates the response email.withFooter(String footer) Adds a custom footer to the response mail body.withGenerator(ResponseBodyGenerator generator) Sets aResponseBodyGeneratorthat is used for generating a response body.withHeader(String header) Adds a custom header to the response mail body.
-
Constructor Details
-
ResponseGenerator
Creates a newResponseGenerator.- Parameters:
processor-EmailProcessorof the challenge email.
-
-
Method Details
-
withHeader
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, ornullif no header is to be used.- Returns:
- itself
-
withGenerator
Sets aResponseBodyGeneratorthat 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-ResponseBodyGeneratorto be used, ornullto 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.mailSessionto be used for this mail.- Returns:
- Generated
Message. - Throws:
jakarta.mail.MessagingException
-