You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/actions/email.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Email Action
2
2
3
-
This actions sends the form data by email. In its simplest form it just appends all form fields in `name: value` pairs as plain text. But it can use a [snippet](#snippet)to build the email, too. You can use snippets to send HTML instead of plain text emails, too.
3
+
This actions sends the form data by email. In its simplest form it just appends all form fields in `name: value` pairs as plain text. But it can use a custom [body](#body) or [template](#template)to build the email, too. You can use templates to send HTML instead of plain text emails, too.
4
4
5
5
If there is an `email` field in the form data, the action will use it as `replyTo` of the sent email and remove it from the email body. If there is a `receive_copy` field present (e.g. a checkbox) and the [receive-copy](#receive-copy) option is set, the action will send a copy of the email to the address specified in the `email` field. The subject of this copy email will get the `uniform-email-copy` prefix.
6
6
@@ -80,6 +80,18 @@ Check out the email templates of the [Uniform repo](https://github.com/mzur/kirb
80
80
!!! warning "Note"
81
81
You cannot access form fields with the name `_data` or `_options` directly in the template as these are reserved for the additional variables provided by Uniform. Use `$_data['_data']` and `$_data['_options']` in this case.
82
82
83
+
### body
84
+
85
+
The body of the email. If not specified, the form data will be used as the body (`name: value` pairs as plain text). The body supports templates, too, so you can dynamically add form data to it. A template is a name of a form field surrounded by `{{}}`. Example:
86
+
87
+
```php
88
+
'body' => 'Dear {{name}}, we will get back to you soon!',
89
+
```
90
+
The body will only be used, if no [template](#template) is specified.
91
+
92
+
!!! warning "Note"
93
+
Body templates do not work with [array form fields](http://stackoverflow.com/a/1978788/1796523).
94
+
83
95
### replyTo
84
96
85
97
Set a static email address as `replyTo` of the email instead of the value of the `email` form field.
0 commit comments