class method self.email_address_with_name

Ruby on Rails 8.1.2

Since v6.1.7.10

Available in: v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

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 603
      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 603 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionMailer::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close