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

Do not accept @ in email address local part unquoted #44094

Closed
j-bernard opened this issue Nov 16, 2021 · 11 comments
Closed

Do not accept @ in email address local part unquoted #44094

j-bernard opened this issue Nov 16, 2021 · 11 comments

Comments

@j-bernard
Copy link
Contributor

j-bernard commented Nov 16, 2021

Symfony version(s) affected

5.3

Description

As per RFC5322, email address local part cannot contain any special character unless quoted but Mailer accepts email addresses containing @.

How to reproduce

$stream = new SocketStream();
$stream
    ->setHost($host)
    ->setPort($port)
    ->disableTls();
$transport = new SmtpTransport($stream);
$mailer = new Mailer($transport);
$email = (new Email())
    ->from($from)
    ->to($to)
    ->subject($subject)
    ->text($body);
$mailer->send($email);

If $to local-part is unquoted and contains @ an email address validation error should be raised.

Possible Solution

The email address validation should use RFCValidation as default as it fails as expected when local part contains @ unquoted.
Note: The exception message should be updated in consequence.

Additional Context

No response

@derrabus
Copy link
Member

Symfony version(s) affected

6.5

Can you please check again? As far as I know, we haven't released a version 6.5 and we currently have no plans to ever release a version 6.5 either. 🙃

@j-bernard
Copy link
Contributor Author

Yes thanks, its 5.3, I made the edit :)

@alexislefebvre
Copy link
Contributor

Could you please share an example of an email string that match with your issue?

@j-bernard
Copy link
Contributor Author

em@il@example.test is invalid but is considered valid: this is the issue.
"em@il"@example.test is the valid form and is correctly considered as valid.

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@xabbuh
Copy link
Member

xabbuh commented Jun 8, 2022

@fabpot Do you remember why MessageIDValidation is favored over RFCValidation ?

@carsonbot carsonbot removed the Stalled label Jun 8, 2022
@fabpot
Copy link
Member

fabpot commented Jul 27, 2022

It's been done by @derrabus as part of supporting version 3 of the email validation lib: https://github.com/symfony/symfony/pull/39685/files#diff-f0d9919249d4352374874b02faa5eba0be74d75a2aee76b37b820e1453bfb3b7R55

@fabpot
Copy link
Member

fabpot commented Jul 27, 2022

The linked PR also has some discussion about email validation.

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@carsonbot
Copy link

Hello? This issue is about to be closed if nobody replies.

@carsonbot
Copy link

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

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

No branches or pull requests

6 participants