10000 Allow to setup connection settings as URI · Issue #101 · symfony/swiftmailer-bundle · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Feb 6, 2022. It is now read-only.

Allow to setup connection settings as URI #101

Closed
kingcrunch opened this issue May 21, 2015 · 2 comments
Closed

Allow to setup connection settings as URI #101

kingcrunch opened this issue May 21, 2015 · 2 comments

Comments

@kingcrunch
Copy link
Contributor

It would be nice, if one can configure one connection with a single string (URI, ...) instead of multiple separate configuration keys

smtp://user:pass@host
@sstok
Copy link
sstok commented May 25, 2015

But how will that work for more complex transporters? :)

@kingcrunch
Copy link
Contributor Author

@sstok Not like this :) I didn't intended to replace the existing setup, but to allow to simplify it (as long as it makes sense and works). Do you have an example of a transport, that may not work?

Actually ... As far as I can see smtp is the only protocol, where it makes "sense", although gmail could look like gmail://foo:bar@~ (or something like that) and everything else is simply sendmail:

fabpot added a commit that referenced this issue Jan 14, 2016
This PR was merged into the 2.3-dev branch.

Discussion
----------


5AF0
Allow to setup transports via URL

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #101
| License       | MIT
| Doc PR        | -

For example as YML

```yml
swiftmailer:
    default_mailer: smtp_mailer
    mailers:
        smtp_mailer:
            url: smtp://username:password@example.com:12345?encryption=tls&auth_mode=login
```

This is primary useful for SMTP-transports. There is no benefit, for "sendmail"-, or "mail"-transports. The intention is, that one only needs to set up one config option/parameter to define a working transport. For example see [`parameters.yml` of `symfony/symfony-standard`](https://github.com/symfony/symfony-standard/blob/2.8/app/config/parameters.yml.dist#L13-L16)

```yml
    mailer_transport:  smtp
    mailer_host:       127.0.0.1
    mailer_user:       ~
    mailer_password:   ~
```

For different stages one usually must set at least "user" and "password" and often "host" too for every stage. With this patch it would look like

```
mailer_url: 'smtp://127.0.0.1'
```

Commits
-------

49219dc Allow to setup transports via URL
@fabpot fabpot closed this as completed Jan 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0