Skip to content

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

Open
@petski

Description

@petski

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy