{"id":11338,"date":"2023-03-07T10:56:51","date_gmt":"2023-03-07T09:56:51","guid":{"rendered":"https:\/\/www.saasweb.agency\/blog\/divi-theme-changing-the-reply-to-of-the-contact-form-module\/"},"modified":"2026-10-27T18:03:06","modified_gmt":"2026-10-27T17:03:06","slug":"divi-theme-changing-the-reply-to-of-the-contact-form-module","status":"publish","type":"post","link":"https:\/\/www.saasweb.agency\/en\/blog\/divi-theme-changing-the-reply-to-of-the-contact-form-module\/","title":{"rendered":"DIVI Theme: Changing the Reply-To of the Contact Form Module"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">By default, DIVI sets the requested email address as the &#8220;Reply-To&#8221; address. The &#8220;Reply-To&#8221; address is the email address to which a message is sent when you click &#8220;Reply&#8221; in your email client. <\/p>\n\n<p class=\"wp-block-paragraph\">In itself, this is quite practical; as a website operator, you receive an email and can click &#8220;Reply&#8221; directly to write back to the person. However, what is supposedly practical is something some mail servers do not like. It is unusual for the sender to have a completely different reply address than the &#8220;Reply-To.&#8221; Spammers use this, for example, by faking a known sender and having you send the reply to a different address via the &#8220;Reply-To.&#8221;   <\/p>\n\n<p class=\"wp-block-paragraph\">Unfortunately, the DIVI module offers no setting to change the &#8220;Reply-To&#8221; field. Therefore, it must be solved differently; we use a filter. The code is simply added to the <em>functions.php<\/em>.  <\/p>\n\n<pre class=\"wp-block-code\"><code>function my_custom_headers($headers, $contact_name, $contact_email){\n\n  $my_headers = array();\n  $header_reply_to_found = false;\n  $http_host = str_replace(\"www.\", \"\", $_SERVER&#091;\"HTTP_HOST\"]);\n\n  for( $i = 0 ; $i &amp;lt; sizeof($headers) ; $i++ ){\n\n    if( preg_match(\"\/Reply-To\/\", $headers&#091;$i]) &gt; 0 ){\n\n      $my_headers&#091;] = \"Reply-To: info@\" . $http_host;\n      $header_reply_to_found = true;\n    }else{\n\n    $my_headers&#091;] = $headers&#091;$i];\n    }\n  }\n\n  if( ! $header_reply_to_found ){\n\n    $my_headers&#091;] = \"Reply-To: info@\" . $http_host;\n  }\n\n  return $my_headers;\n}\n\nadd_filter( 'et_contact_page_headers', 'my_custom_headers', 999, 3 );<\/code><\/pre>\n\n<p class=\"wp-block-paragraph\">In this example, the Reply-To address is set to <em>info@<\/em> of the website domain.<\/p>\n\n<p class=\"wp-block-paragraph\"><strong>Please note:<\/strong> By default, the contact form only sends the content of the message field. If the email address from the form is no longer used as the &#8220;Reply-To,&#8221; you will no longer know who wrote to you. Therefore, you must include that information. This can be done via the &#8220;Email Address&#8221; &gt; &#8220;Message Pattern&#8221; setting, as shown here in the screenshot.   <\/p>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi.png\"><img decoding=\"async\" width=\"1024\" height=\"494\" src=\"https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-1024x494.png\" alt=\"DIVI Message Pattern\" class=\"wp-image-8001\" srcset=\"https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-1024x494.png 1024w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-300x145.png 300w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-768x371.png 768w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-933x450.png 933w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-600x290.png 600w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-50x24.png 50w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-150x72.png 150w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-400x193.png 400w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-100x48.png 100w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-250x121.png 250w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi-1000x483.png 1000w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2023\/03\/screenshot_divi.png 1146w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n<p class=\"blog-angebot wp-block-paragraph\"><strong>Do you need help with your WordPress site?<\/strong> We keep WordPress up to date and secure and help when things get stuck. <a href=\"https:\/\/www.saasweb.agency\/en\/software\/technologies-frameworks\/wordpress\/wordpress-support\/\">More about WordPress Support<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By default, DIVI sets the requested email address as the &#8220;Reply-To&#8221; address. The &#8220;Reply-To&#8221; address is the email address to which a message is sent when you click &#8220;Reply&#8221; in your email client. In itself, this is quite practical; as a website operator, you receive an email and can click &#8220;Reply&#8221; directly to write back \u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[981,983],"tags":[1731,2133,819],"class_list":["post-11338","post","type-post","status-publish","format-standard","hentry","category-programming","category-tutorial","tag-divi","tag-filter","tag-wordpress"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/posts\/11338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/comments?post=11338"}],"version-history":[{"count":2,"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/posts\/11338\/revisions"}],"predecessor-version":[{"id":11927,"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/posts\/11338\/revisions\/11927"}],"wp:attachment":[{"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/media?parent=11338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/categories?post=11338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/tags?post=11338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}