| Post |
|
Guest
| Matthew Kettlewell 7:43 am September 2, 2008
| |
|
|
Please replace the ??? with your data!
- Your URL: http://???
- The browser used: ???
- cforms version: ???
- Your Wordpress version: ???
[desc]:
Oliver,
I'm not sure of what I'm doing wrong in getting my_cforms_action() to kick-in.
Is there anything special that I need to do? I didn't think that there was….
I'm simply trying to get the mail() function in the function to send me an email with bogus data, but its not firing when I send an emai… the mail() function is out of the $formID check, so it should kick off no matter what the ID is… unless I'm missing something ??
I put my mail() code into a test.php file and ran it from the command line with no problems…. so how can I tell that my_cforms_action() is getting called… or am I even calling the right thing?
I'm really just needing to read in a hidden variable, get an email address with it, and then mail it to the email address….
Thanks
Matt
_
|
|
|
Admin
| Oliver Munich, Germany posts 6094 7:50 am September 2, 2008
| |
|
|
Usually all that's required to do is go into my-functions.php and activate (un-comment so to speak) the action routine.
Now that the routine is present/available, it'll be triggered.
the mail() function is out of the $formID check, so it should kick off no matter what the ID is… unless I'm missing something ??
correct.
|
|
|
|
|
Admin
| Oliver Munich, Germany posts 6094 7:51 am September 2, 2008
| |
|
|
PS: I think there is an easier way to do what you want to do, even though it requires some direct cforms coding (a few lines).
|
|
|
|
|
Guest
| Matthew Kettlewell 8:09 am September 2, 2008
| |
|
|
Oliver,
Does it make a difference that I'm using a dynamic form?
I put
$form['Your Name'] = 'BLAH';
in my_cforms_action, and I'm getting my original input, and not BLAH, as we would expect.
Thanks
Matt
|
|
|
Guest
| Matthew Kettlewell 5:57 pm September 2, 2008
| |
|
|
Oliver,
I still couldn't get the hidden variable to be recognized in the my_cforms_action() function, but I was able to get the post processing to work just fine with my_cforms_filter()
I'm using a dynamic form (form 2 in this case) where I process the fields and use them to output a text message via email. By going this route, I'm able to send an email to the originator, business owner, and the admin. I have custom code for get_userdata() that gets the email address for a given user. You can see the live example at http://www.gjzone.com/kettlewell-enterprises and look at the page source for all the fields.
if ( isset($POSTdata['sendbutton2']) ) {
$to = get_usermeta($POSTdata['cf2_field_7'], 'email'); $subject = 'New Message From GJZone.com Client';
$message = " You have a new message from the GJZone.com Website\\n\\n"; $message .= "Contact Information: \\n"; $message .= 'Name: '. $POSTdata['cf2_field_2'] . "\\n"; $message .= 'Email: '. $POSTdata['cf2_field_3'] . "\\n"; $message .= 'Phone: '. $POSTdata['cf2_field_4'] . "\\n"; $message .= 'Web: '. $POSTdata['cf2_field_5'] . "\\n"; $message .= "Message: \\n"; $message .= $POSTdata['cf2_field_6']; $message .= "\\n\\n\\n";
$headers = 'From: general@gjzone.com' . "\\r\\n" . 'Reply-To: '. $POSTdata['cf2_field_3'] . "\\r\\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, stripslashes($message), $headers); }
I hope this inspires or helps someone else.
Matt
|
|
|
Admin
| Oliver Munich, Germany posts 6094 6:29 pm September 2, 2008
| |
|
|
Excellent stuff. Thanks for sharing!
|
|
|
|