From b1563b73bf7361c5b9356e6c1b7981066854b35c Mon Sep 17 00:00:00 2001 From: Martin D Date: Tue, 28 Aug 2018 19:42:12 -0400 Subject: [PATCH] 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. --- docs/en/02_Developer_Guides/10_Email/index.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/en/02_Developer_Guides/10_Email/index.md b/docs/en/02_Developer_Guides/10_Email/index.md index a8cc1578e..4fc535797 100644 --- a/docs/en/02_Developer_Guides/10_Email/index.md +++ b/docs/en/02_Developer_Guides/10_Email/index.md @@ -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' +``` +
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.