This module allows you to configure different SMTP settings for various email types within your Drupal site. It overrides the default SMTP mail backend to enable per-email key SMTP configurations, providing flexibility in how and where your emails are sent.
This module allows for SMTP configurations on a per email key basis by replacing the implementation of smtp's mail backend plugin. It requires the smtp module.
Use the project's settings.php or settings.local.php to add SMTP configurations
keyed by the email key like so:
$settings['smtp_multiple_config']['email_key']['smtp_host'] = 'smtp.gmail.com';
$settings['smtp_multiple_config']['email_key']['smtp_port'] = '465';
$settings['smtp_multiple_config']['email_key']['smtp_protocol'] = 'ssl';
$settings['smtp_multiple_config']['email_key']['smtp_username'] = '[email protected]';
$settings['smtp_multiple_config']['email_key']['smtp_password'] = 'pass';
$settings['smtp_multiple_config']['email_key']['smtp_from'] = '[email protected]';
$settings['smtp_multiple_config']['email_key']['smtp_fromname'] = 'Me';
Alternatively use the hook_smtp_multiple_config_alter() hook:
function my_module_smtp_multiple_config_alter(array &$config, $key) {
if ($key === 'comment_notify_comment_notify_mail') {
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_protocol'] = 'ssl';
$config['smtp_username'] = '[email protected]';
$config['smtp_password'] = 'pass';
$config['smtp_from'] = '[email protected]';
$config['smtp_fromname'] = 'Me';
}
}
Ask your assistant about SMTP Authentication Support (multiple)
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.