Email addresses with + signs are treated as errors

I was just testing the bulk invite feature to see what the message was going to be to users and I used my personal Gmail email but added the + sign. The import failed as you can see below (I replaced my actual email address with validaddress).

Email addresses with + signs are perfectly valid according to RFC 2822 spec, so I’d expect Discourse to allow it.

Your bulk user invite file was processed, 0 invites mailed with 1 error(s).

Here’s the log:

[2020-12-09 20:40:21 +0000] Invalid Email '

This is the regex we use to parse these addresses, I believe:

Run this through and it shows a perfectly valid email with a + sign.

However, it appears the email you provided may have had an invalid character in it.

' – the ' at the beginning probably caused the bulk invite feature to fail.


Thank you. It’s curious: I saw that apostrophe in the error message too and dismissed it initially. I know Excel does that sometimes to text in a cell when you convert it (I coverted this from XLSL to CSV for import), but I’ve double checked the import file (in VS Code) and don’t see any leading apostrophes.

Thank you for providing the regex and clarifying that it should be allowed. I’ll have to tinker more to see if I can figure out why it’s failing. (It failed even when I deleted that user, removed the +test from the email, and tried to re-send the invite.)


As near as I can tell, that leading apostrophe is part of the error message, not my import file. I went ahead and did a bulk import with 86 actual emails. I received errors in two cases (which is bizarre in its own right because I’ve emailed these people). I removed the specific email for this post.

Your bulk user invite file was processed, 84 invites mailed with 2 error(s).

Here’s the log:

[2020-12-09 21:34:42 +0000] Invalid Email '
[2020-12-09 21:34:43 +0000] Invalid Email '