Grow with us: Join Postmark's new referral partner program and start earning
x

Can I use the Postmark for WordPress plugin with Divi contact forms?

Divi by Elegant Themes is a commonly used theme that includes a builder for adding contact forms to your WordPress site. Divi contact forms do use the wp_mail function for sending email by default, so they are compatible with the Postmark for WordPress plugin, with a small change to get working correctly. 

By default, Divi contact forms send from an address you may not have added to your Postmark account, preventing the contact form from successfully sending emails upon submission.

To get your Divi contact forms sending correctly, you will need to make a change to the Divi plugin's code.

Open the file /wp-content/themes/Divi/includes/builder/module/ContactForm.php in your WordPress site's server and you will see this line of code (line 418):

$headers[] = "From: \"{$contact_name}\" <mail@{$http_host}>";

In order to get your forms sending correctly, you will need to modify the email address being used (by default it's set to mail@{$http_host}) so that it is either a confirmed sender signature on your Postmark account or on a domain that you have verified.

For example, if you own the domain mycoolsite.com and have verified it in your Postmark account, you could set the From email address for contact form emails to be contact@mycoolsite.com by making the following change:

$headers[] = "From: \"{$contact_name}\" <contact@mycoolsite.com>";

After saving the changes, you would then have the contact form submission emails sent from a valid address that Postmark can accept.

Last updated July 19th, 2018

Still need some help?

Our customer success team has your back!