Skip to content

Commit fe58908

Browse files
authored
Include name in from address
Extends `email_address_with_name` instructions to demonstrate how to specify a name in the from address.
1 parent 603631b commit fe58908

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

guides/source/action_mailer_basics.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,14 @@ def welcome_email
390390
end
391391
```
392392

393+
The same technique works to specify a sender name:
394+
395+
```ruby
396+
class UserMailer < ApplicationMailer
397+
default from: email_address_with_name('[email protected]', 'Example Company Notifications')
398+
end
399+
```
400+
393401
If the name is a blank string, it returns just the address.
394402

395403
[`email_address_with_name`]: https://api.rubyonrails.org/classes/ActionMailer/Base.html#method-i-email_address_with_name

0 commit comments

Comments
 (0)