Skip to content

Return just the address if name is blank #42970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2021

Conversation

thutterer
Copy link
Contributor

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.

@ghiculescu ghiculescu added the ready PRs ready to merge label Aug 9, 2021
Otherwise the returned string would look like " <foo@example.com>".
@thutterer thutterer force-pushed the email_address_with_blank_name branch from 0eefd7e to 524c4ca Compare September 16, 2021 07:25
@thutterer
Copy link
Contributor Author

Rebased on latest main.

@rafaelfranca rafaelfranca merged commit 0253772 into rails:main Sep 21, 2021
@thutterer thutterer deleted the email_address_with_blank_name branch September 22, 2021 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants