Guest User

sendmail.php

a guest
Jun 6th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  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. "Nnja Form Submission",
  8. 'Name: ' . $_POST['ncf_name_field'] . "\n" .
  9. (isset($_POST['ncf_company_field']) && !empty($_POST['ncf_company_field']) ? ('Company: ' . $_POST['ncf_company_field'] . "\n") : '') .
  10. (isset($_POST['ncf_phone_field']) && !empty($_POST['ncf_phone_field']) ? ('Phone: ' . $_POST['ncf_phone_field'] . "\n") : '') .
  11. (isset($_POST['ncf_address_field']) && !empty($_POST['ncf_address_field']) ? ('Address: ' . $_POST['ncf_address_field'] . "\n") : '') .
  12. 'Email: ' . $_POST['ncf_email_field'] . "\n" .
  13. "\n\n----------------Message-----------------\n\n" .
  14. $_POST['ncf_message_field'] ,
  15. ‘From: Admin <[email protected]>\r\n”
  16. );
  17.  
  18. if($result) {
  19. echo json_encode(array('success' => true, 'result' => $result));
  20. die();
  21. }
  22.  
  23. echo json_encode(array('success' => false, 'message' => __("Message not sent. An unknown error occurred.", 'ninja-contact-form' ), 'result' => $result));
  24. die();
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment