Skip to main content
All CollectionsTroubleshooting and FAQsFrequently Asked QuestionsContact Form Module
How to Customize Default Email's Subject Line Using the Contact Form Module
How to Customize Default Email's Subject Line Using the Contact Form Module

Learn how to customize the subject of the emails sent by Divi Contact Form in order to better organize and manage them.

Updated over a week ago

Customizing the subject line in your Divi's Contact Form Module can help you better organize and manage incoming messages, ensuring clear and relevant communication.

In this article, we will guide you through the process of customizing the subject field in Divi’s Contact Form Module.

  1. Install and Activate a Child theme for Divi

  2. Go to WordPress Dashboard → Appearance → Theme File Editor

  3. Open the ContactForm.php from the Child theme/includes folder

  4. Find this PHP code:

    wp_mail( apply_filters( 'et_contact_page_email_to', $et_email_to ),
    et_get_safe_localization( sprintf(
    __( 'New Message From %1$s%2$s', 'et_builder' ),
    sanitize_text_field( html_entity_decode( $et_site_name, ENT_QUOTES, 'UTF-8' ) ),
    ( '' !== $title ? sprintf( _x( ' - %s', 'contact form title separator', 'et_builder' ), $title ) : '' )
    ) ),
    ! empty( $email_message ) ? $email_message : ' ',
    apply_filters( 'et_contact_page_headers', $headers, $contact_name, $contact_email )
    );

  5. Replace that with this PHP code:

    wp_mail( apply_filters( 'et_contact_page_email_to', $et_email_to ),
    et_get_safe_localization( sprintf(
    __( '%1$s has sent you a message %2$s', 'et_builder' ),
    sanitize_text_field( html_entity_decode( $contact_name, ENT_QUOTES, 'UTF-8' ) ),
    ( '' !== $contact_email ? ' from ' . $contact_email : '' )
    ) ),
    ! empty( $email_message ) ? $email_message : ' ',
    apply_filters( 'et_contact_page_headers', $headers, $contact_name, $contact_email )
    );

  6. Save your changes.

Notes:

  • The above changes will include the name of the person who filled out the Contact Form module fields. For example, if the name used in the Contact Form module is Joe Doe, the subject line will be Joe Doe has sent you a message from email address. Where the email address will actually be the visitor's email address used to fill out the Contact Form module's email field.

  • If you would like to customize the Email's subject line further, change this line of code %1$s has sent you a message %2$s to your preferences.

  • You can also download and use a ready-made Child theme which includes the above changes.

Did this answer your question?