skip to Main Content

WordPress Code Snippets


Customizing the Email Notification in Contact Form 7

You can easily customize the email that gets sent when a form is submitted in Contact Form 7. Below is an example of how to modify the default mail settings to personalize the message.

add_filter('wpcf7_mail_components', 'codebykp_customize_wpcf7_mail_components', 10, 3);

function codebykp_customize_wpcf7_mail_components($components, $form, $instance) {
    // Modify the email body
    $components['body'] = "New message from: " . $components['body'];
    return $components;
}


I’m a WordPress developer with 10+ years of experience in WooCommerce and custom plugins. I combine technical expertise with design flair to help you create standout, user-friendly websites. Let’s transform your digital presence!

Best WordPress Hosting
Back To Top
Search