0

I got into an issue while using a combination of SwiftMailer and Webform on Drupal 9. I found nothing helpfull while Googling and it took me a few days to figure out the issue. Hence I am sharing my findings with you.

My context:

  • Drupal 9.1.3
  • Webform 6.0.2 - with an Email Notification Handler
  • MailSystem 8.x-4.3 - Module: Webform / Formatter: Swift Mailer / Sender: Swift Mailer
  • Swift Mailer 8.x-2.0 - set up to send SMTP emails

The problem:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Swift_AddressEncoder_IdnAddressEncoder::encodeString() must be of the type string, array given, called in /home/www/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php on line 378 in Swift_AddressEncoder_IdnAddressEncoder->encodeString() (line 32 of vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/IdnAddressEncoder.php).

How the problem manifested:

  • the error above was displayed on the website's footer
  • none of the AJAX driven features of the website didn't work - the ones from the admin interface, nor the ones in the front-end

1 Answer 1

0

The cause and my solution:

In the Webform's email handler configuration -> "Send from (website/domain)" section -> "From email" field, I used the [site:mail] token.

In EsmtpTransport.php line 378, the $address parameter had a value of ["[email protected]" => string(0)].

By modifying the "From email" field to "Site email address" solved my problem.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.