2

I have a newsletter (simplenews) being used from time to time and it uses SMTP server to send mail. All other emails from my site should be sent using default interface. How do I do this?

I thought Mail System module could help me with this, but seems I'm doing that wrong thus I can only switch between interfaces, but not assign SMTP to simplenews only and left other using default one. How can I do that?

  • At least for D8 the drupal.org/project/swiftmailer module let's you choose different handlers for different modules. – leymannx Jan 26 '17 at 15:46
  • I'm now trying to use Mail System module for that, but it ignores any custom settings I have added. It still changes default mail class, but when i'm adding a new setting for any module, it is being ignored and mail sent by the class set in default field. What am i doing wrong? – Andriy Nov 4 '17 at 11:43
1

For D7 you can define a custom mail system using the $conf['mail_system']

$conf['mail_system'] = array('mycustom_module_thekey' => 'MyCustomEmailSystem');

Then you can use the drupal_mail function

drupal_mail('mycustom_module', 'thekey', $email, language_default(), $params, $from);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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