Use a Computed Token as 'Mail to' in email handler

Created on 16 November 2022, almost 2 years ago

Problem/Motivation

My website is using a webform that's printed via a Twig template on every node type 'Shop'. In the form, I have a Computed Token that sets the shop's email as a form field (which is a nody field, different for each branch). That's working fine via this solution β†’ . I'm trying to use this Computed Token as the recipient in an email handler. I can't see a way to use tokens as the recipient, because it only let's me set the website's main mail, the users email field in the form, ... But not the token. How can I achieve this?

Steps to reproduce

  1. Set an Entity select field with [current-page:url:unaliased:args:value:1] as the value
  2. Use a Computed Token to generate the shop's email (a node field)
πŸ’¬ Support request
Status

Closed: outdated

Version

6.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium fbreckx Antwerp

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States cdupree

    I understand this may not be the appropriate forum for this but I have not seen OP post it elsewhere and I believe I found a solution.

    After creating a computed twig element which returns an email address based on a condition, in my case the page url, I modify the email handler to use a "Custom To email address...". I use the token of the computed field as the custom email, but append the token with ":raw". For example: [webform_submission:values:computed_email_recipient:raw]

Production build 0.71.5 2024