Please note that this documentation is for the most recent version of this extension. It may not be relevant for older versions. Related documentation can be found in the documentation directory of the extension.
Result mail with double opt-in
This feature allows quiz results to be sent to participants by email only after the participant has confirmed their email address via double opt-in.
Instead of showing the quiz result directly in the frontend, the quiz displays a feedback form. After submitting the form, the participant receives a confirmation email. The actual result email is sent only after the confirmation link has been opened.
Purpose
This feature is useful when quiz results should be used for lead generation or when the website operator wants to collect a verified email address before sending the result.
Typical use cases:
- Personality tests
- Lead-generation quizzes
- Self-assessments
- Marketing campaigns
- Result delivery after email confirmation
Basic workflow
- The participant completes the quiz.
- The matching quiz result is determined based on the reached score.
- If result mail via double opt-in is enabled for this result, the result is not shown directly.
- Instead, the configured feedback form is displayed.
- The participant enters their email address and submits the form.
- An opt-in record is created and stores the matched result.
- A double opt-in email with a confirmation link is sent to the participant.
- The participant clicks the confirmation link.
- The opt-in record is marked as confirmed.
- The result email is sent to the participant.
- A confirmation message is shown in the frontend.
Configuration in the quiz result record
The feature is configured directly in the quiz result record. This makes it possible to display different forms depending on the result.
Send result mail after opt-in
Field: send_result_mail_after_optin
If enabled, the result is not shown directly at the end of the quiz. Instead, the participant must confirm their email address before receiving the result by email.
All following fields are only shown when this checkbox is enabled.
Opt-in mail subject
Field: optin_mail_subject
Subject of the first email that contains the confirmation link.
Example:
Confirm your email to receive your quiz result
Opt-in mail body
Field: optin_mail_body
Content of the confirmation email.
The content can be edited with a minimal RTE. The confirmation link can be inserted using the placeholder:
{confirmationLink}
Recommended usage inside the RTE:
<p>Please confirm your email address to receive your quiz result.</p>
<p><a href="{confirmationLink}">Confirm email address</a></p>
This allows editors to freely define the visible link label.
Result mail subject
Field: result_mail_subject
Subject of the second email that contains the actual quiz result.
Example:
Your quiz result
Result mail body
Field: result_mail_body
Content of the result email.
This field can also be edited with the minimal RTE and may contain placeholders.
Available placeholders
The following placeholders can be used in the opt-in mail and result mail fields:
{score}
{questionsCount}
{questionsCorrect}
{correctPercent}
{quizTitle}
{resultTitle}
{confirmationLink}
Placeholder descriptions
| Placeholder | Description |
|---|---|
{score} |
The score reached by the participant |
{questionsCount} |
Total number of questions |
{questionsCorrect} |
Number of correctly answered questions |
{correctPercent} |
Correctly answered questions in percent |
{quizTitle} |
Title of the quiz |
{resultTitle} |
Title of the matched quiz result |
{confirmationLink} |
Confirmation link for the double opt-in email |
The placeholder {confirmationLink} is only available in the opt-in mail, as the result mail is sent after the confirmation has already happened.
Feedback form requirements
When this feature is enabled, the quiz result must have a feedback form.
The feedback form must contain exactly one email field with the field key:
email
This key is required so the extension can reliably read the participant's email address when the feedback form is submitted.
Additional fields can be configured freely.
Examples:
- Name
- Phone
- Company
- Message
- Privacy checkbox
- Consent checkbox
Required privacy or consent checkboxes should be configured directly in the feedback form by the editor.
Recommended privacy checkbox text
A required checkbox could use a text like:
I would like to receive my quiz result by email and agree that my email address will be processed for this purpose. The confirmation is done via double opt-in. Further information can be found in the privacy policy.
For newsletters, advertising or any further use of the email address, a separate consent checkbox is required.
Opt-in record
When the feedback form is submitted, an opt-in record is created in tx_quiz_domain_model_quizresultmailoptin.
The opt-in record stores the relevant information for the confirmation process.
Typical fields:
| Field | Description |
|---|---|
quiz |
Related quiz |
quiz_result |
Matched quiz result |
email |
Participant email address |
hash |
Unique double opt-in hash |
score |
Reached score |
questions_count |
Total number of questions |
questions_correct |
Number of correctly answered questions |
correct_percent |
Correctly answered questions in percent |
participation_page |
Page the participation took place on |
participated_at |
Time of participation |
confirmed |
Confirmation status |
confirmed_at |
Time of confirmation |
sent_at |
Time when the result email was sent |
The matched result is stored directly in the opt-in record. This prevents the result from changing if quiz result ranges are edited after the participant has submitted the form.
Confirmation link
The confirmation link points to the participation page and is handled by the Extbase action confirmOptin of the Quiz plugin. The unique opt-in hash is passed as hash argument.
Without a route enhancer, the link looks like:
/participation-page?tx_quiz_quiz[action]=confirmOptin&tx_quiz_quiz[controller]=Quiz&tx_quiz_quiz[hash]=HASH
A speaking route can be configured with a route enhancer (see "Human readable URLs"):
routePath: '/confirm-optin/{quiz_hash}'
_controller: 'Quiz::confirmOptin'
_arguments:
quiz_hash: hash
This results in a URL like:
/participation-page/confirm-optin/HASH
Using the participation page has several advantages:
- The quiz context is still available.
- The page layout stays consistent.
- No additional confirmation page is required.
- Existing slug and routing logic can be reused.
Confirmation states
After the participant clicks the confirmation link, the frontend shows a flash message depending on the result of the confirmation.
Successful confirmation
Your email address has been confirmed. Your quiz result is on its way to your inbox.
Already confirmed
This link has already been confirmed.
Expired link
This confirmation link has expired. Please request your result again.
Invalid confirmation link
This confirmation link is invalid.
Mail sending failed
Error while sending your quiz result mail.
Caching
The confirmation action must not be cached.
The confirmation link triggers database changes and sends an email. Therefore the confirmOptin action is configured as a non-cacheable action of the Quiz plugin.
Mail rendering
The mail content is rendered using TYPO3 Fluid mail rendering (FluidEmail).
The request from the controller is passed to the mail service so it can be used for the FluidEmail:
$mail->setRequest($request);
Passing the controller request instead of $GLOBALS['TYPO3_REQUEST'] makes the service cleaner and easier to test.
RTE usage
The opt-in mail body and result mail body fields use a minimal RTE (rteMailMinimal).
The RTE provides a placeholder dropdown that inserts the available placeholders directly into the text.
For normal placeholders, the editor can insert them directly:
You reached {score} points.
For the confirmation link, the editor should use the placeholder as the link target:
<a href="{confirmationLink}">Confirm email address</a>
This keeps the visible link label editable.
Backend tools
The quiz record provides two backend actions for opt-in records.
Reset or delete opt-in records
This action removes existing opt-in records.
It is mainly useful after testing, so test participations can be removed before the quiz goes live.
Export opt-in records
This action exports opt-in records as a CSV file for further processing.
Example use cases:
- Manual processing
- Reporting
- Import into newsletter tools
- Import into CleverReach
Only confirmed records should be used for external newsletter or marketing workflows, and only if the required consent exists.
Important notes
- The feedback form must contain exactly one email field with the key
email. - The result is not displayed in the frontend when result mail via double opt-in is enabled.
- The confirmation link confirms the opt-in and sends the result email.
- The result email is only sent once.
- The opt-in record stores the matched result to avoid later inconsistencies.
- Newsletter or advertising consent must be handled separately from result delivery.
- Ensure that you store the user-related information in the opt-in record only for as long as necessary.
