Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.     $headers = 'From: Contact Form <your_email@example.com>\r\n';
  4.  
  5.    $result = mail(
  6.         'EMAIL@TOSEND.com',
  7.  
  8.         "NKS Contact Form Submission",
  9.  
  10.         'Name: ' .  $_POST['ncf_name_field']  . "\n" .
  11.  
  12.         (isset($_POST['ncf_company_field']) && !empty($_POST['ncf_company_field']) ? ('Company: ' . $_POST['ncf_company_field'] . "\n") : '') .
  13.  
  14.         (isset($_POST['ncf_phone_field']) && !empty($_POST['ncf_phone_field']) ? ('Phone: ' . $_POST['ncf_phone_field'] . "\n") : '') .
  15.  
  16.         (isset($_POST['ncf_address_field']) && !empty($_POST['ncf_address_field']) ? ('Address: ' . $_POST['ncf_address_field'] . "\n") : '') .
  17.  
  18.  
  19.         "\n\n----------------Message-----------------\n\n" .
  20.         $_POST['ncf_message_field'] ,
  21.        $headers
  22.     );
  23.  
  24.     if($result) {
  25.         echo json_encode(array('success' => true, 'result' => $result));
  26.            die();
  27.     }
  28.  
  29.     echo json_encode(array('success' => false, 'message' => "Message not sent. An unknown error occurred.", 'result' => $result));
  30.     die();
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement