Search by

undkonsorten / powermail-subscription

undkonsorten

Undkonsorten Powermail Subscription - Finisher to subscribe e.g. to a newsletter on a powermail form.

Package info

github.com/undkonsorten/powermail_subscription

Homepage

Issues

Type:typo3-cms-extension

pkg:composer/undkonsorten/powermail-subscription

Statistics

Installs: 16

Dependents: 0

Suggesters: 0

Stars: 0

2.0.1 2026-12-02 07:46 UTC

This package is auto-updated.

Last update: 2026-12-02 08:13:37 UTC


README

Extend powermail forms with a checkbox for a newsletter subscription.

The finisher passes the subscription to a connector. Choose the connector which fits your registration extension:

Connector Needs TYPO3
FormSubscriptionConnector undkonsorten/form-subscription (double opt-in via eliashaeussler/typo3-form-consent, addresses in tt_address) 14
RegisteraddressConnector (deprecated) afm/registeraddress 13

Both packages are only suggested, install the one for your connector in your project.

Requirements

  • TYPO3 13.4 or 14.3
  • powermail 13 or 14
  • The package of your connector, see above

Usage

  • Install the extension and the package needed by your connector

  • Decide in your project which connector is used: register it for the ConnectorInterface in your site package's Services.yaml. The extension itself only provides the connectors whose package is installed.

    FormSubscriptionConnector (needs undkonsorten/form-subscription):

    services:
      Undkonsorten\PowermailSubscription\Connector\ConnectorInterface:
        class: 'Undkonsorten\PowermailSubscription\Connector\FormSubscriptionConnector'

    RegisteraddressConnector (deprecated, needs afm/registeraddress, TYPO3 13 only):

    services:
      Undkonsorten\PowermailSubscription\Connector\ConnectorInterface:
        class: 'Undkonsorten\PowermailSubscription\Connector\RegisteraddressConnector'
  • Add TypoScript to register the finisher in powermail and configure the needed properties and field names (see the connector sections below)

  • Clear the cache

The finisher only subscribes if the checkbox field subscriptionField is checked. The consent text is taken from the answer of consentField or, if the field has no answer (e.g. a text field without input), from the field's text. A field with "sender email" enabled must provide the email address.

FormSubscriptionConnector

Newsletter sign-up with double opt-in via form_consent. form_subscription adds the address to tt_address after the approval:

  1. The connector creates a form_consent Consent and sends the double opt-in mail (template ConsentMail, same template paths as the Consent finisher of form_consent: plugin.tx_formconsent.view, can be extended per finisher with templateRootPaths, partialRootPaths and layoutRootPaths). Nothing happens if the address is already subscribed. Pending Consents of earlier submissions for the same address and folder (e.g. another powermail form for the same newsletter) are expired first, so only the link in the newest mail works - like the sign-up forms of form_subscription. Another folder (another newsletter) gets its own Consent and mail.
  2. On approval (confirmation page with the form_consent plugin) the address is added to tt_address with a reference to the Consent, the optional success mail is sent and the visitor is redirected to the optional success page. form_subscription then makes the links of the mail invalid, so the approved Consent cannot be dismissed afterwards.
  3. Dismissal and expiry are handled by form_consent, the unsubscription by the unsubscribe form of form_subscription.
plugin.tx_powermail.settings.setup {
  finishers {
    25 {
      class = Undkonsorten\PowermailSubscription\Finisher\SubscriptionFinisher

      config {
        additionalProperties {
          # tt_address column = powermail field marker
          first_name = firstname
          last_name = lastname
        }
        subscriptionField = newsletter_subscription
        consentField = newsletter_consenttext
        # Storage folder of the addresses and the consents (one folder = one newsletter)
        pid = 138

        formSubscription {
          # Page with the form_consent plugin (mandatory)
          confirmationPid = 5000
          # Validity of the confirmation link in seconds, 0 = unlimited (default 86400)
          approvalPeriod = 604800
          subject = Newsletter registration
          senderAddress = info@example.org
          senderName = Example
          replyToAddress = newsletter@example.org
          replyToName = Example
          # optional, defaults: ConsentMail, 1, 1, 1
          # templateName = ConsentMail
          # templateRootPaths.100 = EXT:my_site_package/Resources/Private/FormConsent/Templates/
          # partialRootPaths.100 = EXT:my_site_package/Resources/Private/FormConsent/Partials/
          # layoutRootPaths.100 = EXT:my_site_package/Resources/Private/FormConsent/Layouts/
          # showDismissLink = 1
          # requireApproveVerification = 1
          # requireDismissVerification = 1

          # optional: redirect after the approval
          successPid = 5002

          # optional: mail after the approval (sent only if templateName is set)
          successMail {
            subject = Newsletter registration successful
            senderAddress = info@example.org
            senderName = Example
            templateName = NewsletterApproveSuccess
            templateRootPaths.100 = EXT:my_site_package/Resources/Private/Form/Email/
            layoutRootPaths.100 = EXT:my_site_package/Resources/Private/FormConsent/Layouts/
          }
        }
      }
    }
  }
}

The Consents are stored in the folder of the addresses (pid) and marked with the form persistence identifier powermail_subscription. Address data, storage pid and the success settings are stored in the Consent data until the approval.

RegisteraddressConnector (deprecated)

afm/registeraddress is not available for TYPO3 14. The connector still works with TYPO3 13 and registeraddress installed. Use the FormSubscriptionConnector for new projects. The RegisteraddressConnector will be removed in the next major version.

plugin.tx_powermail.settings.setup {
  finishers {
    25 {
      class = Undkonsorten\PowermailSubscription\Finisher\SubscriptionFinisher

      config {
        additionalProperties {
          # AddressProperty = fieldname
          firstName = firstname
          lastName = lastname
        }
        subscriptionField = newsletter_subscription
        consentField = newsletter_consenttext
        # save address in pid
        pid = 138
      }
    }
  }
}

Using another registration extension

If you need another connector, implement the Undkonsorten\PowermailSubscription\Connector\ConnectorInterface in your own Connector Class and define what you need in the subscribe method. Implement Undkonsorten\PowermailSubscription\Connector\ConfigurableConnectorInterface instead, if your connector needs further settings: the finisher then passes its complete config before calling subscribe.