SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | ||
| 3 | $headers = array(); | |
| 4 | $headers[] = 'From: ' .$_POST['ncf_name_field'] . ' <' . str_replace(array("\r", "\n", "\n", "\t", ",", ";"), '', $_POST['ncf_email_field']). ">\r\n";
| |
| 5 | ||
| 6 | $result = mail( | |
| 7 | '[email protected]', | |
| 8 | "Nnja Form Submission", | |
| 9 | 'Name: ' . $_POST['ncf_name_field'] . "\n" . | |
| 10 | (isset($_POST['ncf_company_field']) && !empty($_POST['ncf_company_field']) ? ('Company: ' . $_POST['ncf_company_field'] . "\n") : '') .
| |
| 11 | (isset($_POST['ncf_phone_field']) && !empty($_POST['ncf_phone_field']) ? ('Phone: ' . $_POST['ncf_phone_field'] . "\n") : '') .
| |
| 12 | (isset($_POST['ncf_address_field']) && !empty($_POST['ncf_address_field']) ? ('Address: ' . $_POST['ncf_address_field'] . "\n") : '') .
| |
| 13 | 'Email: ' . $_POST['ncf_email_field'] . "\n" . | |
| 14 | "\n\n----------------Message-----------------\n\n" . | |
| 15 | $_POST['ncf_message_field'] , | |
| 16 | - | ‘From: Admin <[email protected]>\r\n” |
| 16 | + | "From: Admin <[email protected]>\r\n" |
| 17 | ); | |
| 18 | ||
| 19 | if($result) {
| |
| 20 | echo json_encode(array('success' => true, 'result' => $result));
| |
| 21 | die(); | |
| 22 | } | |
| 23 | ||
| 24 | echo json_encode(array('success' => false, 'message' => __("Message not sent. An unknown error occurred.", 'ninja-contact-form' ), 'result' => $result));
| |
| 25 | die(); | |
| 26 | ?> |