Skip to content

[Mailer] Implement additional mailer transport options #37432

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

Merged
merged 1 commit into from
Aug 27, 2020

Conversation

fritzmg
Copy link
Contributor

@fritzmg fritzmg commented Jun 26, 2020

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #37300
License MIT
Doc PR symfony/symfony-docs#13911

This implements additional transport configuration options mentioned in #37300. It also adds a command option to be able to define the command used by the sendmail transport.

Examples:

framework:
  mailer:
    transports:
      sendmail: sendmail://default?command=/usr/sbin/sendmail%%20-oi%%20-t
      local_domain: smtps://smtp.example.com?local_domain=example.org
      restart_threshold: smtps://smtp.example.com?restart_threshold=10&restart_threshold_sleep=1
      ping_threshold: smtps://smtp.example.com?ping_threshold=200

@fritzmg
Copy link
Contributor Author

fritzmg commented Aug 27, 2020

Updated against current master. @fabpot I still think that this should be merged as is, otherwise there would still be no way of customising the command of the sendmail transport, regardless of what is configured in the php.ini. This PR is independent of the (very useful) feature of #36131.

@OskarStark
Copy link
Contributor

restart_threshold_sleep is missing in the PR header + the documentation, it is only mentioned in CHANGELOG.md

@fritzmg
Copy link
Contributor Author

fritzmg commented Aug 27, 2020

restart_threshold_sleep is missing in the PR header

Hm, what do you mean by that? It i used in the example.

It is missing from the proposed documentation, that is true.

@fabpot fabpot force-pushed the feature/more-mailer-options branch from 0db6030 to 665d1cd Compare August 27, 2020 14:56
@fabpot
Copy link
Member

fabpot commented Aug 27, 2020

Thank you @fritzmg.

@fabpot fabpot merged commit ba98fd7 into symfony:master Aug 27, 2020
@fritzmg fritzmg deleted the feature/more-mailer-options branch August 27, 2020 14:59
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.2 Oct 5, 2020
@fabpot fabpot mentioned this pull request Oct 5, 2020
leofeyer pushed a commit to contao/contao that referenced this pull request Jan 7, 2021
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #2164
| Docs PR or issue | -

This PR adds support for the `native://default` mailer transport, which uses the PHP `sendmail_path` configuration. Some notes:

* This feature is available in Symfony `5.2.0` and up. Since the `symfony/mailer` dependency is independent from other Symfony packages, it can be allowed to be installed, while everything else stays at Symfony `4.4.*`.
* Since the actual transport factory for the native transport is however defined by the `symfony/framework-bundle`, an additional compiler pass is necessary, to add said transport factory to the container, if supported and not already present. This can be removed once the core requires at least Symfony `5.2.*`.
* Changing the `symfony/mailer` dependency to include `5.2.*` also allows you to use [additional options](symfony/symfony#37432) for your transport (like a local domain for an SMTP relay or a custom sendmail command).

It would be important to include this in the upcoming Contao 4.11 version, as otherwise there exists no possibility of using a custom sendmail command and thus you are stuck with the hardcoded one.

Commits
-------

5ea20a7 support native transport
53836ae use class_exists
3bbd552 update ContaoCoreBundleTest
b084330 check for native mailer support in PluginTest too
4df690a update AddNativeTransportFactoryPassTest for prefer-lowest
72e72d2 Apply suggestions from code review

Co-authored-by: Leo Feyer <github@contao.org>
ad36b75 merge with master
e98b617 removed superfluous function
1969b8e fix merge error
9fbdaf8 CS
49187f0 Merge branch 'master' into use-native-mailer
leofeyer pushed a commit to contao/manager-bundle that referenced this pull request Jan 7, 2021
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #2164
| Docs PR or issue | -

This PR adds support for the `native://default` mailer transport, which uses the PHP `sendmail_path` configuration. Some notes:

* This feature is available in Symfony `5.2.0` and up. Since the `symfony/mailer` dependency is independent from other Symfony packages, it can be allowed to be installed, while everything else stays at Symfony `4.4.*`.
* Since the actual transport factory for the native transport is however defined by the `symfony/framework-bundle`, an additional compiler pass is necessary, to add said transport factory to the container, if supported and not already present. This can be removed once the core requires at least Symfony `5.2.*`.
* Changing the `symfony/mailer` dependency to include `5.2.*` also allows you to use [additional options](symfony/symfony#37432) for your transport (like a local domain for an SMTP relay or a custom sendmail command).

It would be important to include this in the upcoming Contao 4.11 version, as otherwise there exists no possibility of using a custom sendmail command and thus you are stuck with the hardcoded one.

Commits
-------

5ea20a71 support native transport
53836ae6 use class_exists
3bbd552f update ContaoCoreBundleTest
b084330c check for native mailer support in PluginTest too
4df690a8 update AddNativeTransportFactoryPassTest for prefer-lowest
72e72d27 Apply suggestions from code review

Co-authored-by: Leo Feyer <github@contao.org>
ad36b75c merge with master
e98b617f removed superfluous function
1969b8e1 fix merge error
9fbdaf8e CS
49187f05 Merge branch 'master' into use-native-mailer
leofeyer pushed a commit to contao/core-bundle that referenced this pull request Jan 7, 2021
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #2164
| Docs PR or issue | -

This PR adds support for the `native://default` mailer transport, which uses the PHP `sendmail_path` configuration. Some notes:

* This feature is available in Symfony `5.2.0` and up. Since the `symfony/mailer` dependency is independent from other Symfony packages, it can be allowed to be installed, while everything else stays at Symfony `4.4.*`.
* Since the actual transport factory for the native transport is however defined by the `symfony/framework-bundle`, an additional compiler pass is necessary, to add said transport factory to the container, if supported and not already present. This can be removed once the core requires at least Symfony `5.2.*`.
* Changing the `symfony/mailer` dependency to include `5.2.*` also allows you to use [additional options](symfony/symfony#37432) for your transport (like a local domain for an SMTP relay or a custom sendmail command).

It would be important to include this in the upcoming Contao 4.11 version, as otherwise there exists no possibility of using a custom sendmail command and thus you are stuck with the hardcoded one.

Commits
-------

5ea20a71 support native transport
53836ae6 use class_exists
3bbd552f update ContaoCoreBundleTest
b084330c check for native mailer support in PluginTest too
4df690a8 update AddNativeTransportFactoryPassTest for prefer-lowest
72e72d27 Apply suggestions from code review

Co-authored-by: Leo Feyer <github@contao.org>
ad36b75c merge with master
e98b617f removed superfluous function
1969b8e1 fix merge error
9fbdaf8e CS
49187f05 Merge branch 'master' into use-native-mailer
AlexejKossmann pushed a commit to AlexejKossmann/contao that referenced this pull request Apr 6, 2021
…ao#2554)

Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes contao#2164
| Docs PR or issue | -

This PR adds support for the `native://default` mailer transport, which uses the PHP `sendmail_path` configuration. Some notes:

* This feature is available in Symfony `5.2.0` and up. Since the `symfony/mailer` dependency is independent from other Symfony packages, it can be allowed to be installed, while everything else stays at Symfony `4.4.*`.
* Since the actual transport factory for the native transport is however defined by the `symfony/framework-bundle`, an additional compiler pass is necessary, to add said transport factory to the container, if supported and not already present. This can be removed once the core requires at least Symfony `5.2.*`.
* Changing the `symfony/mailer` dependency to include `5.2.*` also allows you to use [additional options](symfony/symfony#37432) for your transport (like a local domain for an SMTP relay or a custom sendmail command).

It would be important to include this in the upcoming Contao 4.11 version, as otherwise there exists no possibility of using a custom sendmail command and thus you are stuck with the hardcoded one.

Commits
-------

5ea20a7 support native transport
53836ae use class_exists
3bbd552 update ContaoCoreBundleTest
b084330 check for native mailer support in PluginTest too
4df690a update AddNativeTransportFactoryPassTest for prefer-lowest
72e72d2 Apply suggestions from code review

Co-authored-by: Leo Feyer <github@contao.org>
ad36b75 merge with master
e98b617 removed superfluous function
1969b8e fix merge error
9fbdaf8 CS
49187f0 Merge branch 'master' into use-native-mailer
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Jul 30, 2021
This PR was squashed before being merged into the 5.2 branch.

Discussion
----------

[Mailer] Document new Mailer transport options

This documents the additional options for the Mailer component introduced in symfony/symfony#37432

Commits
-------

f713212 [Mailer] Document new Mailer transport options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Mailer] Configuration of local domain not possible?
5 participants