Include name in from address

Extends `email_address_with_name` instructions to demonstrate
how to specify a name in the from address.
This commit is contained in:
Matthew LS 2021-10-30 12:16:39 +07:00 committed by GitHub
parent 603631b335
commit fe58908d28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -390,6 +390,14 @@ def welcome_email
end
```
The same technique works to specify a sender name:
```ruby
class UserMailer < ApplicationMailer
default from: email_address_with_name('notification@example.com', 'Example Company Notifications')
end
```
If the name is a blank string, it returns just the address.
[`email_address_with_name`]: https://api.rubyonrails.org/classes/ActionMailer/Base.html#method-i-email_address_with_name