Home Rails Emailname+address,
Post
Cancel

Rails Emailname+address,

refer to: https://stackoverflow.com/questions/957422/rails-actionmailer-format-sender-and-recipient-name-email-address

require 'mail'
address = Mail::Address.new email # ex: "[email protected]"
address.display_name = name.dup   # ex: "John Doe"
# Set the From or Reply-To header to the following:
address.format # returns "John Doe <[email protected]>"
This post is licensed under CC BY 4.0 by the author.