WordPress.org

Ready to get started?Download WordPress

Forums

wpMandrill
How To Exclude Contact Form 7 mail from Mandrill? (4 posts)

  1. abelljefrry
    Member
    Posted 2 months ago #

    Hello WPMandrill team,

    Can I exclude Contact Form 7 mails from going through Mandrill?

    Because I use CF7 as a Zendesk 'dropbox'. Plus, I also use email forwarding service for my Zendesk. (support@mydomain.com to support@mydomain.zendesk.com)

    This setup really hurt my open rate. Any idea how to exclude Contact Form 7 from going through Mandrill?

    Thanks in advance.

    https://wordpress.org/plugins/wpmandrill/

  2. MC_Will
    Member
    Plugin Author

    Posted 2 months ago #

    Hi abelljefrry,

    You can exclude any email using the mandrill_payload filter.

    Once you have identified CF7 emails, probably by checking the automatic tags, just add a field called force_native to the $message received and set it to true.

  3. abelljefrry
    Member
    Posted 2 months ago #

    I'm not really good at writing codes. May I know the code to add that particular field into my $message?

    Thanks in advance. :)

  4. MC_Will
    Member
    Plugin Author

    Posted 2 months ago #

    Hi,

    I don't know the exact tags CF7 is using but the general template should look like this:

    public function excludeCF7($message) {
        $cf7_tag = 'cf7_actual_tag'; //Replace with actual tag used by CF7
        if ( in_array($cf7_tag, $message['tags']['automatic']) ) {
            $message['force_native'] = true;
        }
        return $message;
    }
    add_filter('mandrill_payload', 'excludeCF7');

Reply

You must log in to post.

About this Plugin

About this Topic