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
ConstructorDescriptionResponseGenerator
(EmailProcessor processor) Creates a newResponseGenerator
. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.mail.Message
generateResponse
(jakarta.mail.Session session) Generates the response email.withFooter
(String footer) Adds a custom footer to the response mail body.withGenerator
(ResponseBodyGenerator generator) Sets aResponseBodyGenerator
that 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
-EmailProcessor
of 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, ornull
if no header is to be used.- Returns:
- itself
-
withGenerator
Sets aResponseBodyGenerator
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, ornull
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
-