View difference between Paste ID: GPRjvmrE and Tsypr32J
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]',
7+
        '[email protected]',
8
9
        "NKS Contact Form Submission",
10
11
        'Name: ' .  $_POST['ncf_name_field']  . "\n" .
12
13
        (isset($_POST['ncf_company_field']) && !empty($_POST['ncf_company_field']) ? ('Company: ' . $_POST['ncf_company_field'] . "\n") : '') .
14
15
        (isset($_POST['ncf_phone_field']) && !empty($_POST['ncf_phone_field']) ? ('Phone: ' . $_POST['ncf_phone_field'] . "\n") : '') .
16
17
        (isset($_POST['ncf_address_field']) && !empty($_POST['ncf_address_field']) ? ('Address: ' . $_POST['ncf_address_field'] . "\n") : '') .
18
19
        'Email: ' .  $_POST['ncf_email_field']  . "\n" .
20
        "\n\n----------------Message-----------------\n\n" .
21
        $_POST['ncf_message_field'] ,
22
       $headers
23
    );
24
25
    if($result) {
26
        echo json_encode(array('success' => true, 'result' => $result));
27
           die();
28
    }
29
30
    echo json_encode(array('success' => false, 'message' => "Message not sent. An unknown error occurred.", 'result' => $result));
31
    die();
32
?>