Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* From forum post: */
- $customerPhone = implode('', $obj["q281_primaryPhone"]);
- $customerName = implode('', $obj['q241_fullName']);
- $token = "?token=V5E6dEyuv4nw3HFD98fUF6N8rQWhX3";
- $parameters = $token . "&name=" . $customerName . "&phone=" . $customerPhone . "&size=1";
- $emailfrom = "admin@*****.com"; //Sender, replace with your email
- $emailto = "jesse@****.com"; //Recipient, replace with receivers email
- $subject = "JotForm Test Webhook"; //Email Subject
- //Send email
- mail($emailto, $subject, $parameters, "From: <$emailfrom>");
- //---------------------------------------------------------------------------------------------
- /* --- what should be placed --- - if you want to get the email */
- $result = $_REQUEST['rawRequest'];
- $result = stripslashes($result);
- $obj = json_decode($result, true);
- $emailfrom = "admin@*****.com"; //Sender, replace with your email
- $emailto = "jesse@****.com"; //Recipient, replace with receivers email
- $subject = "JotForm Test Webhook"; //Email Subject
- //Prepare email body text, you can change anything from here
- $body = "Contact Form Submissions"; //Title
- $body .= "n"; //Nothing but new line
- $body .= "Name: ". implode(' ', $obj['q247_fullName247']); // to change full name array to string
- $body .= "n"; //Nothing but new line
- $body .= "n";
- $body .= "Email: ". $obj['q250_emailAddress']; //Replace with your Email field name
- $body .= "n";
- $body .= "Reason for Visit: ". $obj['q277_reasonFor'];
- $body .= "n";
- $body .= "Submissions ID: ". $_POST['submissionID']; //If you'd like to catch submissionsID
- //Send email
- mail($emailto, $subject, $body, "From: <$emailfrom>");
- //------------------------------------------------------------------
- // Now if you want to have the submitted data prepared as some form of parameters then you should modify the code to something like this:
- $result = $_REQUEST['rawRequest'];
- $result = stripslashes($result);
- $obj = json_decode($result, true);
- //We can only now use the $obj variable, in your script (all the way at the top), we did not have it declared..
- $customerPhone = implode('', $obj["q281_primaryPhone"]);
- $customerName = implode('', $obj['q241_fullName']);
- $token = "?token=V5E6dEyuv4nw3HFD98fUF6N8rQWhX3";
- $parameters = $token . "&name=" . $customerName . "&phone=" . $customerPhone . "&size=1";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement