More strict email address parsing (to match nodemailer) - #914
Open
ignatiusm wants to merge 2 commits into
Open
Conversation
iamtanuj18
approved these changes
Aug 4, 2026
iamtanuj18
left a comment
There was a problem hiding this comment.
Fix looks clean and tests cover the paths that matter.
Small hypothetical worth noting: the if branch handles HOSTNAME with http/https prefix nicely via URL parsing. The else branch takes HOSTNAME as-is though, so if someone ever sets HOSTNAME as localhost:5173 (with port, no protocol prefix, via hand-editing .env), it'd still include the port in the from-address and probably fail. Unlikely since .env.example has the protocol and prod uses plain domains, but a defensive port-strip in the else would cover it.
plouka13
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #909
From a slack discussion internally:
"Now looking at this code, I can't see how it possibly worked in the past!! As per the screenshot below, the HOSTNAME would include http:// which isn't a valid domain. My only idea was that maybe a library changed which enforced a more strict parsing.
I was hunting though our package.json and yarn.lock for libraries that might have changed, but our smtp is provided by Ethereal in dev and: checkout their fancy new updated website: https://ethereal.email/ and there is a new update to nodemailer from July 29th with changes that mean that it isn't silently dropping special characters anymore (see second screenshot).
Anyway, I think this is super interesting and am pleased it isn't anything to do with us. I guess the moral of the story is to not rely on special behaviour and try to provide the most specific data whereever possible"
Adds a test to verify the error, and a fix.