mustafa_ab → created an issue.
I'm using Symfony Mailer + Queue Mail and when I send an email from my custom code (custom form) using:
$mail= $mailManager->mail($module, $key, $to, $langcode, $params, $reply, $send);
The queue mail cannot send the email and throws the error:
sh: 1: /usr/sbin/sendmail: not found
[error] Error sending email (from <email address> to <email address> with <email address>).
I did not encounter this issue when I'm using the old Mail System + SwiftMailer + Queue Mail modules.
Also, when I try to send a reset password and a test email while Symfony Mailer + Queue Mail modules are enabled, the emails are sent just fine.
My Implementation:
- Using SMTP Mail policy for Symfony Mailer
- Custom Module that uses Drupal MailManager to send an email.
- I have implemented hook_mail
in my custom module.
function MODULE_mail($key, &$message, $params) {
switch ($key) {
case 'custom_key':
$message['subject'] = $params['subject'];
$message['body'][] = $params['body'];
$message['from'] = \Drupal::config('system.site')->get('mail');
break;
default:
$message['subject'] = 'Default';
$message['body'][] = 'Default Key';
$message['from'] = \Drupal::config('system.site')->get('mail');
}
}
is this related to Queue Mail not compatible yet with Symfony Mailer?