0

I'm using the SMTP Authentication Support plugin for mail from my Drupal 8 server.

Sending mail from a webform works fine as long as the visitor is using the default language, which is English. It does not send when using any other language.

The message in the error log is not helpful:

Error sending e-mail from [email protected] to [email protected]: SMTP Error: Could not connect to SMTP host.

This makes no sense to me. How can it not be connecting, when the same connection information is ok on English?

How can I resolve this? Here's what I've tried to do:

  • I've asked for support on SMTP's issues page, but have not received any response yet.
  • Set the language detection up two different ways: by domain or by URL. Same result on both.
  • Tried two different SMTP servers, with the same result on both.
  • Tried SSL and standard protocols for SMTP.
3
  • What major version of Drupal are you asking about? (6, 7, 8) Commented Jan 3, 2017 at 16:54
  • @LittleCoding - I'm sorry. It's for Drupal 8.
    – croceldon
    Commented Jan 3, 2017 at 17:35
  • This was just a temporary bug in the SMTP module, and was fixed a few months after your bug report in the module's issue queue. See drupal.org/node/2865696
    – anonymous
    Commented Feb 23, 2021 at 19:43

3 Answers 3

2

The problem is that the parameters are not translatable. In my case it has been solved by overriding the values of the port and protocol variables in settings.php.

$config['smtp.settings']['smtp_port'] = '587';
$config['smtp.settings']['smtp_protocol'] = 'tls';
2
  • Thank you. This answere saved my day. A must for all multi-language sites with SMTP Auth Support. Commented Jan 18, 2021 at 12:33
  • This answer got the problem backwards, and gives bad advice. The problem is that the configuration parameters were defined as translatable, meaning that each language needed its own values for these parameters. This was fixed in the module long before this answer was written, by drupal.org/node/2865696. Overriding the configuration settings in settings.php is not a good idea (it hides the problem for just these parameters, it doesn't solve it for all parameters) and is no longer needed - just use the current version of the SMTP module where this is fixed.
    – anonymous
    Commented Feb 23, 2021 at 19:38
1

I applied this patch https://www.drupal.org/node/2865696

After that I copied smtp.settings.yml in the language folder, and I launched drush cim.

I don't know if you use cim/cex for configuration management, but in this way I can send email in other languages

-1

Just for someone who is using Drupal 7 to fix the same issue, because this module's Drupal 7 version does not even have that stupid smtp.schema.yml file. For Drupal 7, go to /sites/all/modules/smtp and in that folder, edit the file called smtp.phpmailer.inc. Find out "Sets connection prefix." and change the "public $SMTPSecure = '';" into "public $SMTPSecure = 'ssl';". Then remember to clear the cache and reenable the SMTP module.

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.