Problem/Motivation
Everything was working with my 1.6 version, but I need to use some new features so I moved to the 2.0beta4 branch. I recreated my transport and set it to default, but the website is still trying to use sendmail. The test works fine, but every other form on the website (general, webform, any form) gets the error:
Symfony\Component\Mailer\Exception\TransportException: Connection to "process /usr/sbin/sendmail -bs" has been closed unexpectedly.
Sendmail is not installed on my system. I can install, but prefer not to as I am just using SMTP. It's like the system doesn't register my default as SMTP.
Steps to reproduce
Remove 1.6 and upgrade entirely to 2.xbeta4. Create SMTP transport and set to default. Remove sendmail predefined transport. Test -> email sends instantly with SMTP. Try any form on the website, get sendmail error.
Proposed resolution
I may have to revert, but would like to keep using 2.0beta4.
Issue fork symfony_mailer-3570695
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
adamps commentedYou said "remove 1.6 and upgrade entirely to 2.xbeta4". If you remove 1.6 first then it's not an upgrade but a fresh install😃.
I cannot reproduce this. I guess there must be something unusual on your site that causes the problem.
Comment #3
lorisbel commentedI have the same problem!
Message Symfony\Component\Mailer\Exception\TransportException: Connection to "process /usr/sbin/sendmail -bs" has been closed unexpectedly. in Symfony\Component\Mailer\Transport\Smtp\Stream\AbstractStream->readLine() (linea 87 di /opt/drupal/vendor/symfony/mailer/Transport/Smtp/Stream/AbstractStream.php).
Comment #4
lorisbel commentedHere the stack traces:
#0 /opt/drupal/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(335): Symfony\Component\Mailer\Transport\Smtp\Stream\AbstractStream->readLine()
#1 /opt/drupal/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(265): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->getFullResponse()
#2 /opt/drupal/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(199): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->start()
#3 /opt/drupal/vendor/symfony/mailer/Transport/AbstractTransport.php(69): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->doSend(Object(Symfony\Component\Mailer\SentMessage))
#4 /opt/drupal/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(137): Symfony\Component\Mailer\Transport\AbstractTransport->send(Object(Symfony\Component\Mime\Email), Object(Symfony\Component\Mailer\DelayedEnvelope))
#5 /opt/drupal/vendor/symfony/mailer/Transport/SendmailTransport.php(75): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->send(Object(Symfony\Component\Mime\Email), NULL)
#6 /opt/drupal/vendor/symfony/mailer/Mailer.php(42): Symfony\Component\Mailer\Transport\SendmailTransport->send(Object(Symfony\Component\Mime\Email), NULL)
#7 /opt/drupal/web/core/lib/Drupal/Core/Mail/Plugin/Mail/SymfonyMailer.php(142): Symfony\Component\Mailer\Mailer->send(Object(Symfony\Component\Mime\Email))
#8 /opt/drupal/web/modules/contrib/mailsystem/src/Adapter.php(50): Drupal\Core\Mail\Plugin\Mail\SymfonyMailer->mail(Array)
#9 /opt/drupal/web/core/lib/Drupal/Core/Mail/MailManager.php(308): Drupal\mailsystem\Adapter->mail(Array)
#10 /opt/drupal/web/core/lib/Drupal/Core/Mail/MailManager.php(181): Drupal\Core\Mail\MailManager->doMail('webform', 'chiedi_all_espe...', 'info@lirh.it', 'it', Array, 'noreply@lirh.it', true)
#11 /opt/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(637): Drupal\Core\Mail\MailManager->{closure:Drupal\Core\Mail\MailManager::mail():180}()
#12 /opt/drupal/web/core/lib/Drupal/Core/Mail/MailManager.php(180): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#13 /opt/drupal/web/modules/contrib/mailsystem/src/MailsystemManager.php(70): Drupal\Core\Mail\MailManager->mail('webform', 'chiedi_all_espe...', 'info@lirh.it', 'it', Array, 'noreply@lirh.it', true)
#14 /opt/drupal/web/modules/contrib/webform/src/Plugin/WebformHandler/EmailWebformHandler.php(1238): Drupal\mailsystem\MailsystemManager->mail('webform', 'chiedi_all_espe...', 'info@lirh.it', 'it', Array, 'noreply@lirh.it')
#15 /opt/drupal/web/modules/contrib/webform/src/Plugin/WebformHandler/EmailWebformHandler.php(887): Drupal\webform\Plugin\WebformHandler\EmailWebformHandler->sendMessage(Object(Drupal\webform\Entity\WebformSubmission), Array)
#16 /opt/drupal/web/modules/contrib/webform/src/Entity/Webform.php(2751): Drupal\webform\Plugin\WebformHandler\EmailWebformHandler->postSave(Object(Drupal\webform\Entity\WebformSubmission), false, NULL)
#17 /opt/drupal/web/modules/contrib/webform/src/WebformSubmissionStorage.php(1235): Drupal\webform\Entity\Webform->invokeHandlers('postSave', Object(Drupal\webform\Entity\WebformSubmission), false, NULL)
#18 /opt/drupal/web/modules/contrib/webform/src/WebformSubmissionStorage.php(1140): Drupal\webform\WebformSubmissionStorage->invokeWebformHandlers('postSave', Object(Drupal\webform\Entity\WebformSubmission), false)
#19 /opt/drupal/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(489): Drupal\webform\WebformSubmissionStorage->doPostSave(Object(Drupal\webform\Entity\WebformSubmission), false)
#20 /opt/drupal/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(806): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\webform\Entity\WebformSubmission))
#21 /opt/drupal/web/modules/contrib/webform/src/WebformSubmissionStorage.php(1003): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\webform\Entity\WebformSubmission))
#22 /opt/drupal/web/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\webform\WebformSubmissionStorage->save(Object(Drupal\webform\Entity\WebformSubmission))
#23 /opt/drupal/web/modules/contrib/webform/src/Entity/WebformSubmission.php(920): Drupal\Core\Entity\EntityBase->save()
#24 /opt/drupal/web/modules/contrib/webform/src/WebformSubmissionForm.php(2052): Drupal\webform\Entity\WebformSubmission->save()
#25 [internal function]: Drupal\webform\WebformSubmissionForm->save(Array, Object(Drupal\Core\Form\FormState))
#26 /opt/drupal/web/core/lib/Drupal/Core/Form/FormSubmitter.php(129): call_user_func_array(Array, Array)
#27 /opt/drupal/web/core/lib/Drupal/Core/Form/FormSubmitter.php(67): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#28 /opt/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#29 /opt/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm('webform_submiss...', Array, Object(Drupal\Core\Form\FormState))
#30 /opt/drupal/web/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\webform\WebformSubmissionForm), Object(Drupal\Core\Form\FormState))
#31 /opt/drupal/web/modules/contrib/webform/src/Entity/Webform.php(1243): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\webform\Entity\WebformSubmission), 'test')
#32 /opt/drupal/web/modules/contrib/webform/src/Controller/WebformTestController.php(128): Drupal\webform\Entity\Webform->getSubmissionForm(Array, 'test')
#33 [internal function]: Drupal\webform\Controller\WebformTestController->testForm(Object(Symfony\Component\HttpFoundation\Request))
#34 /opt/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#35 /opt/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(637): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}()
#36 /opt/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#37 /opt/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#38 /opt/drupal/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}()
#39 /opt/drupal/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#40 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#41 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#42 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#43 /opt/drupal/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#44 /opt/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#45 /opt/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#46 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#47 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#48 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#49 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#50 /opt/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#51 /opt/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#52 {main}
Comment #5
breezeweb commentedwe are also experiencing the same issue. With Mailsystem & symfony_mailer configured as the handlers.
Comment #6
gillesv commentedExperienced the same issue (Webform mails not working after upgrading to 2.x). Noticed that enabling the submodule "Mailer override" (mailer_override) fixed the issue for me.
Comment #7
ptmkenny commentedI also had this issue, and as gillesv noted, you can fix it by enabling the mailer_override module.
When you run the update scripts from 1.x to 2.x, mailer_override is not enabled. However, mailer_override is necessary to override core's standard mail handling in 2.x (in 1.x, I'm pretty sure this is just the default). So since the default changes, everyone who was relying on the previous override behavior will no longer get email sent through this module (instead via core's default, which is sendmail) until they enable the mailer_override module.
I'm not sure whether the fix should be enabling the mailer_override module by default or just documenting this better, so I'm setting this to "Needs work", but it's definitely a reproducible issue.
Comment #8
adamps commentedOK now with #7 I start to understand this issue. It would be great if anyone else posting earlier on the issue could confirm that the enabling mailer_override fixes the issue.
symfony_mailer_update_20002()enabled the mailer_override module, but only if at least one override is enabled. This is not correct as pointed out in #7. The mailer_override module not only is for overriding (optionally replacing another modules mail code with an improved version using the new HTML interfaces of this module), but also for replacing (capturing all emails sent by the old interface, and sending them using symfony mailer).So we can fix it by removing the
if (array_filter($override, fn($x) => $x != 3)) {in that update hook. This won't help any sites that already have upgraded - however I believe there is nothing we can do in that case. We cannot distinguish the case where a site has deliberately chosen to run without replacing the old mail system, so disabled mailer_override module.There may also be some fresh 2.x installs that forgot to install mailer_override, however in that case they likely didn't read the documentation which explicitly covers this.
Comment #10
adamps commentedWould be great if anyone could test
Comment #11
adamps commentedThe phpstan warning in the MR pipeline is also present on 2.x so we can ignore it here.
Comment #13
adamps commented