WordPress plugins conflict: Contact Form 7 and Mail From

Friday 27 March 2009, Alessandro Raffa

Yesterday I received a message sent by Kelly from my contact page. Unfortunately I realized that Mail From plugin conflicts with Contact Form 7 plugin. So Kelly’s message comes from my own website. Kelly, I’m sorry but I can’t reply to your e-mail.

Testing

I tested these two plugins, but surely I didn’t notice the unexpected behavior of the Mail From plugin. So it’s crucial to plan and execute plugins combinations tests. Plugins conflicts may cause warnings or fatal errors. I’ll start developing a WordPress plugin that tries to test all installed plugins against conflicts and function overrides.

The Code

I just looked at the code, and I probably found the problem. Mail From plugin adds two filters to the wp_mail function:

add_filter( 'wp_mail_from', 'mail_from' );
add_filter( 'wp_mail_from_name', 'mail_from_name' );

while Contact Form 7 overrides wp_mail core function:

@wp_mail( $mail_recipient, $mail_subject, $mail_body, $mail_headers );

passing its sender string by the $mail_headers variable.

Share and Enjoy:
  • Facebook
  • TwitThis
  • Google Bookmarks
  • Digg
  • del.icio.us
  • Technorati
  • LinkedIn

Tags: ,

2 Responses to “WordPress plugins conflict: Contact Form 7 and Mail From”

  1. S.Dolinskiy Says:

    Hello! I have the same problem, but can’t solve it. May be disabling MailFrom will help? Unfortunately i dont know other plugins with same functionality.

  2. Alessandro Raffa Says:

    Hi, thanks for commenting. You can use custom field inside the body of the email. Let me know if it works for you.