Skip to content

[Notifier][FakeSMS] Error Email does not comply with addr-spec of RFC 2822 #58535

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

Open
petski opened this issue Oct 10, 2024 · 3 comments
Open

Comments

@petski
Copy link

petski commented Oct 10, 2024

Symfony version(s) affected

6.4

Description

Given the Texter is fakesms
And the DSN is set to fakesms+email://default?to=some@email.com&from=other@email.com
And the SmsMessage-object has a from set to "1234567890"
When this SmsMessage is provided to send()
Then an exception is thrown: Email "1234567890" does not comply with addr-spec of RFC 2822.

How to reproduce

use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Bridge\FakeSms\FakeSmsEmailTransport;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\Transport\NullTransport;

$texter = new FakeSmsEmailTransport(new Mailer(new NullTransport()), 'foo@bar.com', 'baz@foo.com'); // Normally from DSN

$sms = new SmsMessage(
  '+1411111111',
  'A new login was detected!',
  '+1422222222'
);

$sentMessage = $texter->send($sms);

Possible Solution

@@ -1,6 +1,6 @@
 $email = (new Email())
-    ->from($message->getFrom() ?: $this->from)
+    ->from($this->from)
     ->to($this->to)
-    ->subject(sprintf('New SMS on phone number: %s', $message->getPhone()))
+    ->subject(sprintf('New SMS on phone number: %s (from: %s)', $message->getPhone(), $message->getFrom()))
     ->html($message->getSubject())
     ->text($message->getSubject());

Additional Context

@petski petski added the Bug label Oct 10, 2024
petski added a commit to petski/symfony that referenced this issue Oct 11, 2024
Fixes `Error Email does not comply with addr-spec of RFC 2822`

See: symfony#58535
petski added a commit to petski/symfony that referenced this issue Oct 11, 2024
Fixes `Error Email does not comply with addr-spec of RFC 2822`

See: symfony#58535
petski added a commit to petski/symfony that referenced this issue Oct 13, 2024
Fixes `Error Email does not comply with addr-spec of RFC 2822`

See: symfony#58535
petski added a commit to petski/symfony that referenced this issue Oct 13, 2024
Fixes `Error Email does not comply with addr-spec of RFC 2822`

See: symfony#58535
petski added a commit to petski/symfony that referenced this issue Oct 13, 2024
Fixes `Error Email does not comply with addr-spec of RFC 2822`

See: symfony#58535
@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

Friendly ping? Should this still be open? I will close if I don't hear anything.

@petski
Copy link
Author

petski commented Apr 26, 2025

Still valid. I'll dust off and reopen the PR when I find some time

@carsonbot carsonbot removed the Stalled label Apr 26, 2025
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

2 participants