Return just the address if name is blank #42970
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This changes the behavior of ActionMailer's
email_address_with_name
when the provided name is a blank string like""
or" "
. Instead of returning something like" <foo@example.com>"
, it now just returns the email address as provided, e.g."foo@example.com"
.I'm not 100% sure if the old behavior could actually confuse and stop all (or some?) mail server from sending out emails like this, but I definitely found it unexpected and odd looking when using
ActionMailer::Base.email_address_with_name
to display email messages in an UI, where both the values for address and name came from an API that returned a""
for missing names.