Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Notifier/SmsMessage] Add setFrom method #45435

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

Closed
miedzikd opened this issue Feb 16, 2022 · 0 comments · Fixed by #45987
Closed

[Notifier/SmsMessage] Add setFrom method #45435

miedzikd opened this issue Feb 16, 2022 · 0 comments · Fixed by #45987

Comments

@miedzikd
Copy link

miedzikd commented Feb 16, 2022

Description

We would love to start using Symfony Notifier for sending SMS notifications in our project. We have just one blocker.
In most countries, we use our brand name in the sender name. But due to regulations in the U.S., we have to use a regular number. Due to the volume of messages we send, we have several numbers that we use evenly.

Right now we can define default 'from' when we set DNS (Docs). But there is no posibility to change this default variable.

What do you think about adding setForm method on SmsMessage class? I think this optional step will be really helpful not only for us :)
If you agree I can prepare PR - it looks like not really complicated issue :)

We love what are you doing :)
Greetings from Poland
Daniel

Example

use Symfony\Component\Notifier\Message\SmsMessage;

$sms = new SmsMessage(
  // the phone number to send the SMS message to
  '+1411111111',
  // the message
  'A new login was detected!'
);
$sms->setFrom('+48 123 456 789');

$sentMessage = $texter->send($sms);
@fabpot fabpot closed this as completed Jul 26, 2022
fabpot added a commit that referenced this issue Jul 26, 2022
This PR was merged into the 6.2 branch.

Discussion
----------

[Notifier] Add `from` in `SmsMessage`

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #45435
| License       | MIT
| Doc PR        | symfony/symfony-docs#16701 [WIP]

This PR allow to define `From` in `SmsMessage`. When it defined, it override default `from` in transports.

```php
$sms = new SmsMessage(
  // the phone number to send the SMS message to
  '+1411111111',
  // the message
  'A new login was detected!',
  // [Optional] the From SMS message, it can also be a name
  '+1422222222',
);

// Can also be defined with setter
$sms->setFrom('+1422222222');

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

Commits
-------

21b5051 [Notifier] Add from in SmsMessage and support it in bridge transports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants