DOCS How to specify textual name with Email::admin_email (#8337)

* Allow use of display names with SwiftMailer

The syntax to allow display names with SwiftMailer is as follow:
`->setFrom(['john@doe.com' => 'John Doe'])`

Just like you set the `Email.admin_email`, you can set the default sender display name through the `Email.admin_email_displayname` configuration setting.

Refs:
- https://swiftmailer.symfony.com/docs/introduction.html#basic-usage
- https://docs.silverstripe.org/en/4/developer_guides/email/#administrator-emails

* Update Email.php

Simpler code using `Email.admin_email` as an associative array

* Update index.md

Added documentation showing how to add an email display name.
This commit is contained in:
Martin D 2018-08-28 19:42:12 -04:00 committed by Maxime Rainville
parent dbfc253021
commit b1563b73bf
1 changed files with 8 additions and 0 deletions

View File

@ -133,6 +133,14 @@ SilverStripe\Control\Email\Email:
admin_email: support@example.com
```
To add a display name, set `admin_email` as follow.
```yaml
SilverStripe\Control\Email\Email:
admin_email:
support@example.com: 'Support team'
```
<div class="alert" markdown="1">
Remember, setting a `from` address that doesn't come from your domain (such as the users email) will likely see your
email marked as spam. If you want to send from another address think about using the `setReplyTo` method.