3

Is there a do_action() or an add_filter() that I can implement to use my own send mail function instead of Elegant Theme's wp_mail() function in their Divi theme?

I want to intercept the Divi emailer function and use my own for a contact us form.

  • 1
    There might be. The people at Divi should be able to tell you, as it's not a general WP question. – cjbj Jun 16 '17 at 9:28
2

If Divi theme uses wp_mail() function (which most likely does), you can use the wp_mail filter to pass your own arguments to the function:

function filter_divi_mail( $args ) {
    // Modify the options here
    $custom_mail = array(
        'to'          => $args['to'],
        'subject'     => $args['subject'],
        'message'     => $args['message'],
        'headers'     => $args['headers'],
        'attachments' => $args['attachments'],
    );
    // Return the value to the original function to send the email
    return $custom_mail;
}
add_filter( 'wp_mail', 'filter_divi_mail' );

Not the answer you're looking for? Browse other questions tagged or ask your own question.