Send Email Using PHP Mail Function



Code  : - 

index.php


<html>

<head>
    
    

  <title>Home | CSZONE</title>
  <meta charset="UTF-8">
  <meta name="description" content="Websit Of CSZONE">
  <meta name="keywords" content="HTML,CSS,XML,JavaScript">
  <meta name="author" content="CS">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="theme-color" content="#DCDCDC" />
  
  

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" ></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" ></script>


<style>
body {
    
    font-family:verdana;
    font-weight:bold;
    
    

}


.cs-text-success{
  font-color:#DCDCDC;
  font-size:20;
  text-align:center;

}

.btn{
background-color:#DCDCDC;
color:#000000;
}



footer{


background-color:lightgrey;

}
.cs-container {
  position: relative;
  text-align: center;
  color: green;
}


h1{

text-align:center;
color:#000000;
}
</style>

</head>


<body>



<!----------------------------Contact----------------------------------------------------------------------->
<br><br>
<h1 id="contact"> Contact</h1>

<div class="footer">

 <form method="post" action="sendmail.php"class="form-group" ><br>
  <table class="table" >
<tr class=" bg-light text-darkgrey">
<td> 1.Email:</td><td> <input name="email" class="form-control" type="email" required /></td>
</tr >
<tr class=" bg-light text-darkgrey">
<td> 2.Subject:</td><td>  <input name="subject" class="form-control" ctype="text" required /></td>
</tr>
<tr class=" bg-light text-darkgrey">
<td> 3.Message:</td><td><textarea style="resize:none" name="comment" class="form-control"cols="80" rows="2" required></textarea></td>
</tr>
<tr class=" bg-light text-darkgrey">
<td></td> <td><input type="submit" class="btn btn-success"value="Send" /></td>
 </tr> 

 <tr class=" bg-light text-darkgrey"><td>Contact No  : </td><td> 6261638554</td></tr>
 <tr class=" bg-light text-darkgrey"><td>Email    : </td><td> aryansn0101@gmail.com</td></tr>
 <tr class=" bg-light text-darkgrey "><td>Address   : </td><td> Near SBI Hindoria , Damoh</td></tr>


 </table>
  </form>
  
  <br>
 </div>

<br>
<!--------------------------------------------------Contact------------------------------------------------------------------->

</html>


sendmail.php


<?php
//if "email" variable is filled out, send email
  if (isset($_REQUEST['email']))  {
  
  //Email information
  $admin_email = "yourmail@gmail.com";
  $email = $_REQUEST['email'];
  $subject = $_REQUEST['subject'];
  $comment = $_REQUEST['comment'];
  
  //send email
  mail($admin_email, "$subject", $comment, "From:" . $email);
  
  //Email response
  $message = "Message Sent";
echo "<script type='text/javascript'>alert('$message');</script>";
  echo "<script>window.location='index.php'</script>";
  }
  
  
?>










Comments

Popular posts from this blog

HTML Signup Login Form With Source Code