Advertisement
Iyanyan

Action php send email contact form

Oct 20th, 2019
1,864
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. $to="info@website.com";
  8.  
  9. $message="Dear, <br /> <br />".$message;
  10.  
  11. $headers = "MIME-Version: 1.0" . "\r\n";
  12. $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
  13.  
  14. // More headers
  15. $headers .= 'From:'.$name.' <'.$email.'>'."\r\n" . 'Reply-To: '.$name.' <'.$email.'>'."\r\n";
  16. $headers .= 'Cc: admin@email.com' . "\r\n"; //untuk cc lebih dari satu tinggal kasih koma
  17. @mail($to,$subject,$message,$headers);
  18. if (@mail) { ?>
  19. <script language="javascript" type="text/javascript">
  20. alert('Thank you for the message. We will contact you shortly.');
  21. window.location = 'contact.html';
  22. </script>
  23. <?php
  24. }
  25. else { ?>
  26. <script language="javascript" type="text/javascript">
  27. alert('Message failed. Please, send an email to xxxx@email.co.id');
  28. window.location = 'contact.html';
  29. </script>
  30. <?php
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement