• The way that this plugin decides failure cases isn’t very good. If you look in wpmandrill.php, lines 66 onwards:

    if (    is_wp_error($sent) 
       || !isset($sent[0]['status']) 
       || ($sent[0]['status'] != 'sent' && $sent[0]['status'] != 'queued') ) {
    return wpMandrill::wp_mail_native( $to, $subject, $message, $headers, $attachments );
    

    This looks at the first recipient in the outgoing mail and, if that mail failed, tries to send it via the built-in wp_mail. However… if the first user has unsubscribed, the status will be ‘rejected’ and the mail will be sent with wp_mail. Which means that, if the first recipient of your email has unsubscribed, every single person (including all those that have unsubscribed) will be sent a message via built-in wp_mail. So everyone who’s still subscribed will get it twice and the unsubscribers will get it once.

    One fix for this is just to add $sent[0]['status'] != 'rejected' to the accepted list of responses. But this isn’t quite ideal, because there are other reasons the mail might be rejected (e.g. invalid-sender) which will apply to every single recipient in the list and probably ought to cause the mail to be sent again with wp_mail.

    If you guys are actively maintaining this, I’d be happy to come up with ideas and submit.

    In other news – first bug on new fork! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Matt Miller

    (@millermedianow)

    Hi there, thanks for the idea! Makes total sense.

    We have a public repo for this here:
    https://github.com/Miller-Media/send-emails-with-mandrill

    And we’d be more than happy to accept pull requests if you want to fork the repository and submit which we can then review and merge when all looks good.

    Either way, we’re happy to take a look and create a patch as well but may be a good opportunity to get you in the mix. I’ll add the public repository link in the description so others can contribute as well.

    Thanks, looking forward to bringing this thing back to life!

    Thread Starter pugwonk

    (@pugwonk)

    Thank you! I’ve submitted a PR on that repo.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Users who’ve unsubscribed still get emails (in a roundabout way)’ is closed to new replies.