All Collections
FAQ's and Troubleshooting
Customizing The Subject Of The Contact Form Module
Customizing The Subject Of The Contact Form Module

Learn how to modify the subject of the email that is sent from Divi Contact Form

Karen avatar
Written by Karen
Updated over a week ago

These changes require to install a Divi child theme with a contact form module inside. Check the following article if you don't have a child theme with the Contact Form module in it yet:
https://intercom.help/elegantthemes/faq-s-and-troubleshooting/moving-contact-form-module-to-child-theme

Next, open up  includes/ContactForm.php  file from the child theme folder and search for this 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 )
);


and replace it with:

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 ? ' by ' . $contact_email : '' )
) ),
! empty( $email_message ) ? $email_message : ' ',
apply_filters( 'et_contact_page_headers', $headers, $contact_name, $contact_email )
);


That's it. Now you should see the sender's email in the subject of your emails that are sent from the Divi Contact Form Module.

If you'd like to further customize the Subject line, you can replace this piece of text with your own Subject:

%1$s has sent you a message %2$s


Ready-made child theme that contains all the described changes can be downloaded here: Custom Subject Contact Form Child Theme

Did this answer your question?