Problem/Motivation

Cron is spitting out a lot of errors like:

Exception: Error sending e-mail (from <em class="placeholder">example@test.com</em> to <em class="placeholder"></em>). in Drupal\queue_mail\Plugin\QueueWorker\SendMailQueueWorker->processItem() (line 87 of /data/app/modules/contrib/queue_mail/src/Plugin/QueueWorker/SendMailQueueWorker.php)
Error sending email (from example@test.com to  with reply-to not set).

Tracing this back to the source, it's due to workbench_email adding NULL recipients for accounts without an email address. I'm using SwiftMailer so it's success return value is based on the number of emails sent (which will be 0 for a null TO). This is used by SendMailQueueWorker to evaluate if the mail was successful, if not it'll log an error and throw an exception.

Proposed resolution

Add an array_filter to the prepareRecipients function in WorkbenchTransitionEventSubscriber

Remaining tasks

Tests, code.

Comments

acbramley created an issue. See original summary.

acbramley’s picture

Title: Empty emails can be added which causes exception to be thrown by queue_mail » Accounts with an empty mail field can be added as recipients which causes exception to be thrown by queue_mail
acbramley’s picture

StatusFileSize
new1.03 KB

Here's a failing test.

acbramley’s picture

Status: Active » Needs review
acbramley’s picture

StatusFileSize
new1.59 KB

And the fix.

The last submitted patch, 3: 2927034-failing-test-3.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 5: 2927034-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

acbramley’s picture

2nd failure is not related to my changes by the looks of it:

Remaining deprecation notices (6)

Specifying 'type' => 'hidden' is deprecated, use 'region' => 'hidden' instead: 6x
    6x in WorkbenchTransitionEmailTest::testEndToEnd from Drupal\Tests\workbench_email\Functional
acbramley’s picture

D.O went down and caused a triple post.

acbramley’s picture

D.O went down and caused a triple post.

larowlan’s picture

Not sure how someone would get an account without an email, but this looks good to me.

larowlan’s picture

Status: Needs work » Needs review

Queued on 8.4 where there are no deprecations

acbramley’s picture

@larowlan the email field isn't required any more on the user creation form :) (I was surprised too) http://cgit.drupalcode.org/drupal/tree/core/modules/user/src/AccountForm...

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

  • larowlan committed c62f336 on 8.x-1.x authored by acbramley
    Issue #2927034 by acbramley: Accounts with an empty mail field can be...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

rolling 8.x-1.0-alpha7

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.