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

From address / sender name - quotes vs commas #377

Closed
ErisDS opened this issue Jan 9, 2015 · 1 comment
Closed

From address / sender name - quotes vs commas #377

ErisDS opened this issue Jan 9, 2015 · 1 comment

Comments

@ErisDS
Copy link

ErisDS commented Jan 9, 2015

I'm not sure if this is really a bug, it's probably a common-sense issue, possibly a documentation issue, but I thought I'd raise it because it caused some fun in Ghost (see TryGhost/Ghost#4779).

Essentially, if the sender name contains a comma, then quotes are required.

In the README it says:

from - The e-mail address of the sender. All e-mail addresses can be plain 'sender@server.com' or formatted 'Sender Name sender@server.com', see here for details

To, cc and bcc are all explicitly stated as being comma-separated lists.

Under the Address Formatting section, the examples all show the sender name in quotes, E.g. '"Sender Name" sender@server.com', but a little further down in SMTP Envelope, it shows the sender address without quotes:

from: 'Daemon <deamon@kreata.ee>',

A sender name without quotes works perfectly fine, until your sender name includes a comma. To use a common example:

from: 'Wolfe, Hannah <hello@ghost.org>',

It seems at this point, what happens depends on what mail service you're using. Mailgun seems to figure this out as being from: 'Hannah <hello@ghost.org>', but sendmail (I think) seems to get utterly confused and send mail from 'anonymous <127.0.0.1>'.

It's probably not at all sensible to try to do use a dynamic sender name without the quotes, however it might be worth either updating the documentation to make sure all the examples contain the quotes, or perhaps implementing a fix or validation of some sort to prevent others from falling into the same trap.

Thanks for listening :)

@andris9
Copy link
Member

andris9 commented Jan 12, 2015

That's a valid point, I added a note about the comma to the Address Formatting section.

I think that mainly this is a cultural issue – in my locale (Estonian) nobody uses comma in their name, so I didn't ever think of it when I first created Nodemailer. In fact, the first Nodemailer cold-heartedly split the address field value on all commas with simple string.split(',') and thus it wasn't even possible to use commas in the name part. The support for commas turned out to be an actually required behavior, so I updated the module to accept commas in quoted strings as well.

Anyway, all address fields are lists, not single values, even from and that's by the standard. There's a separate field called sender to indicate who actually sent out the message if there's multiple from addresses – for example if you still live in the seventies, a bunch of people compose the message (these people are mentioned in the from header) and you send it out (you are on the sender field).

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