Sunday, 1 December 2013

Send e-mail in PHP

For Sending Mail in PHP their is inbuilt funtion to send e-mails in php but this function only works in server where you can send your e-mail with your server e-mails.


Here is running example of mail function in php

$email_to = "sender-email";
        $email_subject = "Subject";
$email_message = "Name: ".$name."\n";
    $email_message .= "Email: ".$email."\n";
    $email_message .= "Subject: ".$sub."\n";
    $email_message .= "Message: ".$messagenew."\n";
// create email headers
$headers = 'From: '.$email."\r\n".
'Reply-To: '.$email."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
echo"<script>alert('Thank you for contacting us. We will be in touch with you very soon.');</script>";
<form action="Contact.php" method="post" class="std" enctype="multipart/form-data">
<h1 style='color:black'>Send a message</h1>
<p class="text select">
<label for="id_order">Name</label>
<input type="text" name="name" id="name" value="" />
<p class="text select">
<label for="id_order">Subject</label>
<input type="text" name="Subject" id="Subject" value="" />
<p class="text">
   <label for="email">E-mail address</label>
<input type="text" id="email" name="email" value="" />
<p class="textarea">
<label for="message">Message</label>
<textarea id="message" name="message" ></textarea>
<p class="submit">
<input type="submit" name="btn_email" id="btn_email" value="Send" class="button_large" onclick="$(this).hide();" />
You Can Download It From Here : Click Here

For Any Query Please Write a comment !!