Skip to content
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

FormatAddress shouldn't insert empty quoted name #54

Closed
mackstann opened this issue Mar 18, 2016 · 3 comments
Closed

FormatAddress shouldn't insert empty quoted name #54

mackstann opened this issue Mar 18, 2016 · 3 comments

Comments

@mackstann
Copy link

When calling FormatAddress with an empty name, like:

FormatAddress("foo@bar.com", "")

It returns:

"" <foo@bar.com>

But it would be better to return:

<foo@bar.com>

Normally it wouldn't matter all that much, but there is a bug in Go 1.5 and up that rejects such addresses with an error: golang/go#14866

Removing the redundant "" would greatly help work around this Go bug.

In the meantime, a hack like this will work around it:

if name == "" {
    message.SetHeader("To", address) // bypass FormatAddress altogether
} else {
    message.SetAddressHeader("To", address, name)
}
@alexcesaro
Copy link
Member

Fixed, thanks!

@mackstann
Copy link
Author

Your fast action was very helpful to our team! Thank you!

@alexcesaro
Copy link
Member

Glad it helped 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants