Advertisement
AbdullahHejazi

PHP SENDMAIL

Feb 11th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <?php
  2.  
  3.     if (isset($_POST['email']) && isset($_POST['subject']) && isset($_POST['message'])){
  4.         $emailTo = "YOUR EMAIL";
  5.         $subject = $_POST['subject'];
  6.         $body = $_POST['message'];
  7.  
  8.         $header = "From: ".$_POST['email'];
  9.  
  10.  
  11.         if(mail($emailTo, $subject, $body, $header)){
  12.             $res = array('status' => "ok");
  13.             echo json_encode($res);
  14.         }else{
  15.             $res = array('status' => "bad");
  16.             echo json_encode($res);
  17.         }
  18.     }else{
  19.         $res = array('status' => "bad");
  20.         echo json_encode($res);
  21.     }
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement