WP Form action - email design

Hi guys
can someone please tell me if it is possible to design the email that is generated by the wordpress form action? I’ve searched the documentation and forum but can’t find anything like it.

thanks for your help
horst

Hi @HoWin,
The WordPress for action is pretty simple. There isn’t really any hooks or anything. The only way you could change it is to alter the wp_simple_form_mailer.php file in your exported theme. However, at that point it is probably easier to use a form plugin or implement your own mailer.
Sorry,
Bob

Hi Bob
Thank you for your quick reply. I already thought so, but I wanted to be on the safe side, hence my question.

Thanks again
Horst

Hi @RobM

Could I please ask you one more question to this subject?

What do I have to make so that WP_SIMPLE_FORM_MAILER.PHP sends an e-mail CC to another recipient?

I adapted WP_SIMPLE_FORM_MAILER.PHP to my needs (multilingual html e-mail for different purposes (contact form, sample order, fair registration)) and the only thing that’s missing is an e-mail copy to the sender. Than this script would be perfect for me, and no need for a plugin :slight_smile:

Thanks for your help.
Horst

Hi @HoWin,
Well, the proper way to do it would be to use a filter in your ‘functions.php’. It sounds like you are already altering the base file. If it is always going to be the same CC address then you can add it into the $headers. It is best to do it as an array, but I think it will be fine to just add it to the existing From field. So in the send_to_email conditional after the first $headers declaration add:

$cc_email = sanitize_email('ccemail@example.com');
$headers .= 'cc: ' . $cc_email . "\r\n";

I think that should work. If not, you will have to convert the current header to an array and add the cc email to that array.
Let me know,
Bob

Hi @RobM

Thanks for your help. I modified wp_simple_form_mailer.php to my needs (HTML e-Mail, cc to the originator of the e-mail and so on). I used the content of $_POST[] to fill the e-Mail and everything works fine now.

I’m not quite sure if this is the best way to do it (because now on every export I get the notice that wp_simple_form_mailer.php was modified outside Pinegrow), but it’s better than to implement an extra plugin.

Maybe this would be a nice feature for Pinegrow for some future improvements. At the moment you can style the on screen message inside Pinegrow. So why not use this piece of code inside the e-mail too? Maybe it would work with some hook, but I don’t know how to do it :frowning:

Thanks again, and have a nice day.
Horst

1 Like