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

[Mime] Add NamedAddress::fromString #33086

Closed
gisostallenberg opened this issue Aug 9, 2019 · 2 comments
Closed

[Mime] Add NamedAddress::fromString #33086

gisostallenberg opened this issue Aug 9, 2019 · 2 comments

Comments

@gisostallenberg
Copy link
Contributor

Description
I'm about to build a feature to convert an encoded address to a NamedAddress instance, but thought it might be interesting adding it in the mime component by default. This makes it easier and more readable to use addresses in configuration for example.

Example

use Symfony\Component\Mime\NamedAddress;

$address = NamedAddress::fromString("Giso Stallenberg <gisostallenberg@example.com>"); // instance of NamedAddress
$address->getName(); // Giso Stallenberg
$address->getAddress(); // gisostallenberg@example.com
@fabpot
Copy link
Member

fabpot commented Aug 9, 2019

Great! That looks like a good addition.

@gisostallenberg
Copy link
Contributor Author

Cool, I'll try to create a PR

@fabpot fabpot closed this as completed Aug 19, 2019
fabpot added a commit that referenced this issue Aug 22, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[Mime] Add Address::fromString

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #33086
| License       | MIT
| Doc PR        | symfony/symfony-docs#12128

This will allow to create a Address from a string such as 'Name <name@example.com>'
Example:
```php
$address = Address::fromString("Name <name@example.com>");
```

Commits
-------

75ea8d0 Add Address::fromString
gisostallenberg added a commit to gisostallenberg/symfony-docs that referenced this issue Aug 22, 2019
javiereguiluz added a commit to symfony/symfony-docs that referenced this issue Sep 2, 2019
This PR was squashed before being merged into the 4.4 branch (closes #12128).

Discussion
----------

Add docs on Address::fromString

See symfony/symfony#33086

Commits
-------

36960eb Add docs on Address::fromString
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

3 participants