Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $headers = 'From: Contact Form <your_email@example.com>\r\n';
- $result = mail(
- 'EMAIL@TOSEND.com',
- "NKS Contact Form Submission",
- 'Name: ' . $_POST['ncf_name_field'] . "\n" .
- (isset($_POST['ncf_company_field']) && !empty($_POST['ncf_company_field']) ? ('Company: ' . $_POST['ncf_company_field'] . "\n") : '') .
- (isset($_POST['ncf_phone_field']) && !empty($_POST['ncf_phone_field']) ? ('Phone: ' . $_POST['ncf_phone_field'] . "\n") : '') .
- (isset($_POST['ncf_address_field']) && !empty($_POST['ncf_address_field']) ? ('Address: ' . $_POST['ncf_address_field'] . "\n") : '') .
- "\n\n----------------Message-----------------\n\n" .
- $_POST['ncf_message_field'] ,
- $headers
- );
- if($result) {
- echo json_encode(array('success' => true, 'result' => $result));
- die();
- }
- echo json_encode(array('success' => false, 'message' => "Message not sent. An unknown error occurred.", 'result' => $result));
- die();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement