Iyanyan

Action php send email contact form

Oct 20th, 2019
1,883
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. <?php
  2. $name=$_POST['name'];
  3. $email=$_POST['email'];
  4. $subject=$_POST['subject'];
  5. $message=$_POST['message'];
  6.  
  7.  
  8. $message="Dear, <br /> <br />".$message;
  9.  
  10. $headers = "MIME-Version: 1.0" . "\r\n";
  11. $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
  12.  
  13. // More headers
  14. $headers .= 'From:'.$name.' <'.$email.'>'."\r\n" . 'Reply-To: '.$name.' <'.$email.'>'."\r\n";
  15. $headers .= 'Cc: [email protected]' . "\r\n"; //untuk cc lebih dari satu tinggal kasih koma
  16. @mail($to,$subject,$message,$headers);
  17. if (@mail) { ?>
  18. <script language="javascript" type="text/javascript">
  19. alert('Thank you for the message. We will contact you shortly.');
  20. window.location = 'contact.html';
  21. </script>
  22. <?php
  23. }
  24. else { ?>
  25. <script language="javascript" type="text/javascript">
  26. alert('Message failed. Please, send an email to [email protected]');
  27. window.location = 'contact.html';
  28. </script>
  29. <?php
  30. }
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment