Users who’ve unsubscribed still get emails (in a roundabout way)
-
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! ??
- The topic ‘Users who’ve unsubscribed still get emails (in a roundabout way)’ is closed to new replies.