Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Open
Description
Symfony version(s) affected
6.4
Description
Given the Texter isfakesms
And the DSN is set tofakesms+email://default?to=some@email.com&from=other@email.com
And theSmsMessage
-object has afrom
set to "1234567890"
When thisSmsMessage
is provided tosend()
Then an exception is thrown:Email "1234567890" does not comply with addr-spec of RFC 2822.
How to reproduce
useSymfony\Component\Notifier\Message\SmsMessage;useSymfony\Component\Notifier\Bridge\FakeSms\FakeSmsEmailTransport;useSymfony\Component\Mailer\Mailer;useSymfony\Component\Mailer\Transport\NullTransport;$texter =newFakeSmsEmailTransport(newMailer(newNullTransport()),'foo@bar.com','baz@foo.com');// Normally from DSN$sms =newSmsMessage('+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());