payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
25.43k stars 1.62k forks source link

plugin-form email builder should provide a placeholder to send all values as a table #8254

Closed yobottehg closed 1 month ago

yobottehg commented 1 month ago

Link to reproduction

No response

Environment Info

Binaries:
  Node: 20.17.0
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  payload: 3.0.0-beta.106
  next: 15.0.0-canary.106
  @payloadcms/db-postgres: 3.0.0-beta.106
  @payloadcms/email-nodemailer: 3.0.0-beta.106
  @payloadcms/graphql: 3.0.0-beta.106
  @payloadcms/next/utilities: 3.0.0-beta.106
  @payloadcms/plugin-form-builder: 3.0.0-beta.106
  @payloadcms/plugin-redirects: 3.0.0-beta.106
  @payloadcms/plugin-search: 3.0.0-beta.106
  @payloadcms/plugin-seo: 3.0.0-beta.106
  @payloadcms/richtext-lexical: 3.0.0-beta.106
  @payloadcms/translations: 3.0.0-beta.106
  @payloadcms/ui/shared: 3.0.0-beta.106
  react: 19.0.0-rc-06d0b89e-20240801
  react-dom: 19.0.0-rc-06d0b89e-20240801
Operating System:
  Platform: linux
  Arch: arm64
  Version: #1 SMP Mon Aug 12 08:47:01 UTC 2024
  Available memory (MB): 15975
  Available CPU cores: 8

Describe the Bug

Currently authors need to provide every field name and value in the email message template. To maintain this in conjunction with the form fields and in addition on multiple emails that are send via that form is error prone and cumbersome.

Other CMS solve this more intelligently.

For example Drupal webforms module has the following default mail body:

<p>Send data:</p>
[webform_submission:values]

The token [webform_submission:values] will be converted to a table of all fields as key / value pairs.

This most likely covers 90% of the use cases of all administration emails while reducing author load and errors.

Reproduction Steps

See description.

Adapters and Plugins

plugin-form

paulpopus commented 1 month ago

Added this feature in this PR https://github.com/payloadcms/payload/pull/8271

You can now output all submission data using {{*}} wildcard and {{*:table}} if you want it rendered as a table in your email.

github-actions[bot] commented 1 month ago

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.