Skip to content

FormatAddress shouldn't insert empty quoted name #54

@mackstann

Description

@mackstann

When calling FormatAddress with an empty name, like:

FormatAddress("[email protected]", "")

It returns:

But it would be better to return:

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)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions