Skip to content

Double opt-in

With double opt-in, a submission’s actions (emails, webhooks, data objects, …) wait until the visitor confirms their email address with a link. Many countries require this for newsletters.

Turn it on in the form editor’s Settings tab, or in the definition:

"doubleOptIn": {"enabled": true, "emailField": "email", "expiresHours": 48, "template": "", "confirmedRedirect": "/en/welcome"}
Key Meaning
emailField The email field the link goes to. Publishing checks that it is an email field of the form
expiresHours How long the link works, 1 to 720 hours. Default 48
template Empty for the built-in mail, or the id of a Pimcore Email document
confirmedRedirect Where the link leads after confirming: a URL, a path or {"documentId": 12}. Empty: a simple “confirmed” page
  1. The visitor sends the form. The submission is stored with status received. The answer says “Please check your email”, unless the form has its own success message.
  2. A job on the pimkit_forms queue makes a one-time token and mails the link /pimkit/forms/api/doi/{token}. Only a SHA-256 hash of the token is stored, and the token never sits in the queue. The link uses the host the form was sent from.
  3. The visitor clicks: the submission becomes confirmed (doi_confirmed_at is set), SubmissionConfirmedEvent is dispatched and the actions are queued.
  4. A second click (mail apps and virus scanners open links too) shows “already confirmed” and runs nothing again. An expired or unknown link shows a message with HTTP 410.

If the email field is empty, there is nobody to ask: the actions run right away. Submissions that are never confirmed stay received without running any action. With “store submissions” off, their data is kept until they are confirmed.

The built-in mail is in the submission’s language (pimkit_forms.doi.* translations) and has a button and the plain link. A Pimcore Email document gets these parameters: confirm_url, expires_at, form_title, form_name, locale.

  • SubmissionStoredEvent::$awaitingConfirmation is true for submissions that wait for the click.
  • SubmissionConfirmedEvent follows the click.