There are lots of post on this but none of them give an example of how one might go about it so I'm hoping to create a post here that others can use to solve this issue until it becomes a core feature.
I'm trying to allow the sender to send themselves a copy of the message. Right now I have it so on post submission if the checkbox is checked I'm getting the email field but I need to know the best way to duplicate the notifications.
Here is what I have:
add_action("gform_post_submission_1", "my_submit_form", 10, 2);
function my_submit_form($entry){
//if checkbox value is set to true then display the email address
if($entry["4.1"] =="true"){
die ($entry["2"]);
}
}
This is just a simple test to get the email address. Now my question is, can I use a built in form feature to send a copy of the message or should i use wp_mail
or mailto()
instead? An example would be awesome