Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I use the smtp module in conjunction with the yamlform module and have in this form a field for file upload. But in the e-mail message I have this field not included.
After submit the form I get the error from SMTPMailSystem:
Warning: Invalid argument supplied for foreach() in Drupal\smtp\Plugin\Mail\SMTPMailSystem->mail() (line 404 of modules/contrib/smtp/src/Plugin/Mail/SMTPMailSystem.php).
Drupal\smtp\Plugin\Mail\SMTPMailSystem->mail(Array) (Line: 227)
Drupal\Core\Mail\MailManager->mail('yamlform', 'email.e_mail', 'xxxxx', 'de', Array, 'xxxxx') (Line: 509)
Drupal\yamlform\Plugin\YamlFormHandler\EmailYamlFormHandler->sendMessage(Array) (Line: 418)
Drupal\yamlform\Plugin\YamlFormHandler\EmailYamlFormHandler->postSave(Object, , NULL) (Line: 1248)
Drupal\yamlform\Entity\YamlForm->invokeHandlers('postSave', Object, , NULL) (Line: 557)
Drupal\yamlform\YamlFormSubmissionStorage->invokeYamlFormHandlers('postSave', Object, ) (Line: 524)
Drupal\yamlform\YamlFormSubmissionStorage->doPostSave(Object, ) (Line: 395)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 761)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 364)
Drupal\Core\Entity\Entity->save() (Line: 603)
Drupal\yamlform\Entity\YamlFormSubmission->save() (Line: 747)
Drupal\yamlform\YamlFormSubmissionForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 583)
Drupal\Core\Form\FormBuilder->processForm('yamlform_submission_application_form_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 601)
Drupal\yamlform\Entity\YamlForm->getSubmissionForm(Array) (Line: 83)
Drupal\yamlform\Controller\YamlFormTestController->testForm(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
The problem is that in my case the "$message['params']['attachments']" variable is not empty, instead it contains "false". So the if condition in line 404 is satisfied.
Comment | File | Size | Author |
---|---|---|---|
#6 | smtp-empty-attachment-2783207-6.patch | 738 bytes | cbeier |
#4 | smtp-empty-attachment-2783207-4.patch | 738 bytes | cbeier |
#3 | smtp-empty-attachment-2783207-3-D8.patch | 738 bytes | simgui8 |
#2 | 2783207-empty-attachments-warning-2.patch | 705 bytes | cbeier |
Comments
Comment #2
cbeier CreditAttribution: cbeier commentedComment #3
simgui8 CreditAttribution: simgui8 as a volunteer and commentedSame as cbeier,
warning when submitting a yamlform.
same reason.
This patch fix it lattest dev 2016-oct-17
Comment #4
cbeier CreditAttribution: cbeier commentedPatch rerolled.
Comment #5
cbeier CreditAttribution: cbeier commentedComment #6
cbeier CreditAttribution: cbeier commentedPatch rerolled.
Comment #7
estoyausenteIt seems ok. It is a simple patch.
Comment #8
Chris Matthews CreditAttribution: Chris Matthews as a volunteer and at City of Oaks Design commentedThe patch in #6 was RTBC'd 3 years ago and still applies cleanly to 8.x-1.x-dev. Can this be committed?
Comment #9
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedComment #11
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commented