-
-
Notifications
You must be signed in to change notification settings - Fork 154
Conversation
@@ -50,25 +50,31 @@ protected function configure() | |||
*/ | |||
protected function execute(InputInterface $input, OutputInterface $output) | |||
{ | |||
$mailer = $this->getContainer()->get('mailer'); | |||
$transport = $mailer->getTransport(); | |||
if ($this->getContainer()->getParameter('swiftmailer.spool.enabled')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the command should send flush the spool for a single mailer instead of looping over all of them (with an argument or an option to select the mailer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With an optional argument ?
You should have 2 tests with the extended config formats: one with several mailers (the one you added here) and 1 with a single mailer IMO. It will show you that the XML config is wrong currently (parsing XML produces a different result for 1 or several childs, and using a bad XML structure does not allow the Config component to normalize it) |
you also need to update the profiler integration to avoid mixing the different mailers together (it might require branching for 2.3 as the DataCollector is in the bridge) |
$mailer['port'] = 'ssl' === $mailer['encryption'] ? 465 : 25; | ||
} | ||
|
||
foreach (array('encryption', 'port', 'host', 'username', 'password', 'auth_mode', 'timeout', 'source_ip') as $key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be inside the if statement as it only applies to SMTP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll fix it.
I've added the test with a single mailer and the DataCollector. |
Nice job! 👍 |
👍 Much needed |
What to you think about it @stof ? |
Tested, looks ready 🔨 |
@jeremyFreeAgent / @shouze - it says Travis is failing? |
@bmeynell it's because of the <container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd"> in the tests XML files. |
@bmeynell : @jeremyFreeAgent can't upload the new xsd on symfony.com... so unless he puts a file:// scheme with the complete local filesystem path to the xsd it won't pass tests... and of course no way to do it. This feature is non BC break and tests will pass when the new xsd will be online. |
Is this a configuration BC break? I seemed to had to define the |
Hmm.. CLI works but symfony doesn't load via the web:
Thoughts? |
Yes there's also a PR on SwiftMailerBridge ;) Le vendredi 3 mai 2013, Ben Meynell a écrit :
Cordialement, |
Yes, you should update the bridge too. @bmeynell can you write your config please? I will take a look. Thanky. |
Bridge updated! TY! @jeremyFreeAgent - My config: mailers:
default:
encryption: ssl
auth_mode: login
transport: %mailer.transport%
host: %mailer.host%
port: %mailer.port%
username: %mailer.user%
password: %mailer.password%
antiflood:
threshold: 100
sleep: 1
second:
encryption: ssl
auth_mode: login
transport: %mailer.transport%
host: %mailer.host%
port: %mailer.port%
username: %second.mailer.user%
password: %second.mailer.password%
antiflood:
threshold: 100
sleep: 1 Error:
|
@bmeynell Fixed, typo in the parameter name. Sorry. |
@@ -35,6 +36,7 @@ protected function configure() | |||
->addOption('message-limit', 0, InputOption::VALUE_OPTIONAL, 'The maximum number of messages to send.') | |||
->addOption('time-limit', 0, InputOption::VALUE_OPTIONAL, 'The time limit for sending messages (in seconds).') | |||
->addOption('recover-timeout', 0, InputOption::VALUE_OPTIONAL, 'The timeout for recovering messages that have taken too long to send (in seconds).') | |||
->addArgument('mailer', InputArgument::OPTIONAL, 'The mailer name.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you use an option rather than an optional argument ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the command help should be updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sure.
+2 |
->setHelp(<<<EOF | ||
The <info>%command.name%</info> displays the configured mailers: | ||
|
||
<info>php %command.full_name%</info> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name argument should be documented.
Just to make sure: is this BC? |
@fabpot the user-facing services are BC. The only BC break is in the data collector for the profiler, which is why it should be kept in sync with the symfony PR, and why I suggested to move the collector to the bundle as it is not generic anyway (it relies on the container) |
ok, moving the data collector to the bundle is fine. |
Done ;) |
This PR was merged into the master branch. Discussion ---------- Added mailers Now you can configure several mailers. Commits ------- cf5de43 Added mailers
Merged now. Thank you very much to everyone who was involved in this long-running PR (especially @jeremyFreeAgent for his patience). Anyone willing to update the documentation for this feature? |
Thanks @fabpot ! Can you give me a SensioLabsConnect "long PR badge" for that ? lol |
This PR was squashed before being merged into the master branch (closes #42). Discussion ---------- fix OutOfBoundsException when using mail or sendmail transport Hi, Since the #34 had been merged, an exception occured when using mail or sendmail transport : ``` [Symfony\Component\DependencyInjection\Exception\OutOfBoundsException] The index "1" is not in the range [0, 0]. ``` This patch fix it. Commits ------- 01fb626 fix OutOfBoundsException when using mail or sendmail transport
…or (PR symfony#8520) This PR was merged into the master branch. Discussion ---------- [SwiftmailerBridge] Marked MessageDataCollector as deprecated | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | yes | Deprecations? | yes | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Now you can configure several mailers. Linked to the following PR: - [ ] symfony/swiftmailer-bundle#34 Commits ------- 15bf1d7 [SwiftmailerBridge] Marked MessageDataCollector as deprecated
return; | ||
} | ||
|
||
$definition = $container->findDefinition('swiftmailer.transport'); | ||
foreach ($container->findTaggedServiceIds('swiftmailer.plugin') as $id => $args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a BC break. ping @jeremyFreeAgent ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about registering swiftmailer.plugin
services to each transport?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know swift mailer enough ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't looking like a BC break at the time we did that. @lyrixx have you experienced any breakage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wep, my plugin is not registered anymore. Anyway, I just updated the tag name ;)
Now you can configure several mailers.