class method self.email_address_with_name

Ruby on Rails edge

Since v6.1.7.10

Available in: v6.1.7.10 v7.0.10 v7.1.6 v7.2.3.2 v8.0.5.1 v8.1.3.1 edge

Signature

self.email_address_with_name(address, name)

Returns an email in the format “Name <email@example.com>”.

If the name is a blank string, it returns just the address.

Parameters

address req
name req
Source
# File actionmailer/lib/action_mailer/base.rb, line 604
      def email_address_with_name(address, name)
        Mail::Address.new.tap do |builder|
          builder.address = address
          builder.display_name = name.presence
        end.to_s
      end

Defined in actionmailer/lib/action_mailer/base.rb line 604 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionMailer::Base

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close