Prior to using Queue Mail, I was sending an email using custom code like this:
$result = $mailer->mail($module, $key, $to, $language, $params, NULL, $send);
if ($result['result'] !== TRUE) {
// Report error.
}
else {
// Report success.
}
When using Queue Mail, $send is set to FALSE, so $result['result'] doesn't get returned as TRUE. This makes it appear that the process failed. It would be helpful if there were a return value to indicate that the message was successfully queued.
Patch to follow.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3039506-2.add-return-value.patch | 566 bytes | jrb |
Comments
Comment #2
jrbAttached patch adds a boolean $result['queued'] to the array returned by the call to \Drupal::service('plugin.manager.mail')->mail() so you can have code like this:
Comment #3
jrbComment #5
sokru commentedComment #7
sinn commentedComment #8
sinn commented