If you are using Divi wordpress theme, to build custom layouts for your wordpress posts, pages or projects, and use the Contact form Module to each of the post or project, you will notice that the subject of the email you will recieve is not to good.
Let’s just think that you have an affiliate website like this one, when for each theme (project) you want to have this Cotact Form module which can be use if someone will ask you for a particular topic. For example, I put on my website some of the themes that Elegat Themes offers, and for each theme at the bottom I have a contact form.
I want when someone will use a contact form from any theme, the email subject I will receive to be: Customization request for {project_name}. A more relevan example will be:
Joe Doe, will find this project called Divi WordPress theme and he will fill out the contact form to ask for a customization support. My email which I will receive from Joe Doe, will have the subject: Customization request for Divi WordPress theme, which is the actual title for this particular project.
To do that, we will need to edit/modify the function.php
file. First make sure to backup this file, open it in your favorit text editor and go to line 2115 or search for $et_site_name = get_option( 'blogname' );
. You can delete this line or you can leave it. After this line add this line of code:
$post_name = get_the_title( $post->ID );
Next replace this block of code (line 2124):
wp_mail( apply_filters( 'et_contact_page_email_to', $et_email_to ),
sprintf( __( 'Customization Request for %1$s%2$s', 'Divi' ),
sanitize_text_field( $et_site_name ),
( '' !== $title ? sprintf( _x( ' - %s', 'contact form title separator', 'Divi' ), sanitize_text_field( $title ) ) : '' )
), stripslashes( wp_strip_all_tags( $POST['et_pb_contact_message'] ) ), apply_filters( 'et_contact_page_headers', $headers, $contact_name, $contact_email ) );
with this:
wp_mail( apply_filters( 'et_contact_page_email_to', $et_email_to ),
sprintf( __( 'Customization request for %1$s', 'Divi' ),
sanitize_text_field( $post_name )), stripslashes( wp_strip_all_tags( $POST['et_pb_contact_message'] ) ), apply_filters( 'et_contact_page_headers', $headers, $contact_name, $contact_email ) );
[box type=”warning”]Make sure to replace the php variable $POST in the above code blocks with the correct one: $ _ POST
but with no spaces. I had to make that change because in some wired way wordpress tried to execute that php code.[/box]

Save the file and uploaded to your server.
Now when someone will use the Divi Contact Form Module, which you have place it on a post, page or project, the email subject you will receive will be the post / page / project title.
hello, do you know how to change the “Thanks for contacting us” to something else?
Yes, but first can you please let me know what version are you using?!
I have the se question and I’m using 2.5.5.
🙂
Hi Eduard – I’d like to know the same thing. I’m using Version 4.3.1. Many thanks, William
Hi guys I will do my best to create a new post this weekend to walk you trough the process.
I will notify you as soon as the post is ready.
Would also love to know how to change that line “Thanks for contacting us” 🙂
Hi guys I just publish the article on how to chanage the thank you message. You can read the article here: http://wordpress-corner.com/custom-contact-module-divi-2-5-6/
Thanks Eduard – I am new to WordPress – I was expecting to be able to change the message within the Divi module or php file (having said that, I couldn’t find where the message is located) rather than having to add a new module.
Hi, did you follow the instruction I did posted here: http://wordpress-corner.com/custom-contact-module-divi-2-5-6/?
I did created instructions, how to properly change the Thank you message, you just need to edit the string: Thanks for contacting us, in this piece of code:
esc_html__( 'Thanks for contacting us', 'et_builder' )
. I did choose to use a child theme, so you guys keep this change even if you update you parent theme. If you don’t want to use a child theme, then you can edit the php file called main-modules.php located in divi/includes/builder folder, and just do a search for ‘Thanks for contacting us’ to find the string you need to change.Hope this helps.
Best Regards.
Cool – it worked! All I needed was to know where to locate the string. Thank you Eduard and merry Christmas!
Glad to hear that William, Merry Christmas to you too.
Hi need help . I install the Divi theme in Don’t recived the Emails From them. I sending 5 emails in only recived one. What happen with the rest. Help please
Hi please check with your hosting company, since this could be related to your server configuration. Also you can try to install Contact Form 7 plugin, and see if that one works. Hope it helps.
Hi Eduard, we are using Divi builder and need help customizing the contact form module. We would like the form to simply display the submit button (no spaces for entry of name/email/etc) on project pages so that when a logged in user clicks the submit button, an email is sent to our admin email with the logged in users name, email and tag of project name or url in email message body. Currently, you will be unable to view the actual project page as it is restricted to members. Please email as we would like to speak with you about contracting your services for this work.
Have you used a divi-child theme to do that?
You said to modify the functions.php and for me, this file is located at my child divi themeI, but the lines you’ve showed are not there.
I do not understood.
Hi, yes, all the changes should be done into a child theme. But please be aware that this topic, will not be compatible with the latest Divi version. In the latest Divi version, the process is completely different than this topic.
Thank you in advance
Best Regards.
Hi, is it possible to add e header image to the email or are there any other options to modify the email appearance?
Not quite sure what you mean? Do you want to edit the email template?