How to send mail in php from localhost using wamp server

Share:

PHP - how to send email from localhost WAMP Server



php - How to send email from localhost WAMP Server to send email.
Send email from localhost/WAMP Server using sendmail.
Send email using WAMPSERVER - localhost - PHP.
How To Send Email From Localhost Using PHP.
how to send email from localhost using php


Mail.php page code below



<?php 
  
if(isset($_REQUEST['btnSubmit'])) 
            { 
             
                $email_subject = "Microsoft ASP Solutions".$today = date("F j, Y,  h:m:s");  
          
                        
            $name = $_POST['name']; // required
            $em = $_POST['email']; // required
                        $lname = $_POST['lname']; // required
            
    $email_message = "Order Details.\n\n";
    
    //$email_to = $em;
    $email_to ="your email address";


    function clean_string($string) 
    {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
         
    $email_message .= "Name :".clean_string($name)."\n";
    
    $email_message .= "Email : ".clean_string($email)."\n";
                
    $email_message .= "Last Name : ".clean_string($lname)."\n";
               
     
    $headers = 'From:'."yourwebsite.com"."\r\n";
    @mail($email_to, $email_subject, $email_message, $headers);
     
           echo "<script>alert('Your Email is Successfully Send')</script>";
      }     
        ?>
 
<html>
 <head>
 </head>
 <body>
<form name="contactform" action="mail.php" method="post" >
<table width="450px">
 
<tr>
 
 <td valign="top">
 
  <label for="first_name">First Name *</label>
 
 </td>
 
 <td valign="top">
 
  <input  type="text" name="name" maxlength="50" size="30">
 
 </td>
 
</tr>
 
<tr>
 
 <td valign="top"">
 
  <label for="last_name">Last Name *</label>
 
 </td>
 
 <td valign="top">
 
  <input  type="text" name="lname" maxlength="50" size="30">
 
 </td>
 
</tr>
 
<tr>
 
 <td valign="top">
 
  <label for="email">Email Address *</label>
 
 </td>
 
 <td valign="top">
 
  <input  type="text" name="email" maxlength="80" size="30">

 </td>
 
</tr>
 

 
<tr>
 
 <td colspan="2" style="text-align:center">
 
  <input type="submit" name="btnSubmit" formaction="mail.php" value="Submit">
 
 </td>
 
</tr>
 
</table>
 
</form>
</body>
</html>

No comments