Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ($_SERVER['REQUEST_METHOD'] == 'POST')
- {
- //we need to get our variables first
- $email_to = 'my-email-address@mail.ru'; //the address to which the email will be sent
- $email = $_POST['email'];
- $name = $_POST['name'];
- $subject = $_POST['subject'];
- $tel = $_POST['tel'];
- $message = $_POST['message'];
- $message = "\nNaam = $name \nE-mailadres = $email \nOnderwerp = $subject \nTelefoonnummer = $tel \nBericht = $message";
- // Echo "Name: $FirstNam . \tEmail Address: $Email " ;
- /*the $header variable is for the additional headers in the mail function,
- we are asigning 2 values, first one is FROM and the second one is REPLY-TO.
- That way when we want to reply the email gmail(or yahoo or hotmail...) will know
- who are we replying to. */
- $headers = "MIME-Version: 1.0" . "\r\n";
- $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
- $headers = "From: ".$email ."\r\n";
- $headers .= "Reply-To: $email\r\n";
- if(mail($email_to, $name, $message, $headers)){
- echo 'ok'; // we are sending this text to the ajax request telling it that the mail is sent..
- }else{
- echo 'failed';// ... or this one to tell it that it wasn't sent
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement