PHP Mail Using Localhost
Switch Your Xampp or Wamp Dir go to Your htdocs Directory and then
Switch Your PHP directory
Open Your Configuration Files open php.ini file notepad or Other Editor
Search mail_functions
Add the Some Configuration and
[mail function]
SMTP=localhost
smtp_port=25
sendmail_path = Your send mail .exe
sendmail_path = C:\xampp\sendmail\sendmail.exe
then Save
Open Your Send Mail Directory and open sendmail configuration
smtp_server=domain.host.com
smtp_server=smtp.gmail.com
smtp_port=25
smtp_port=587
smtp_ssl=sll ---->Change tls
smtp_ssl=tls
auth_username=yourgmail.com
auth_password=your gmail password
Then Save and Restart Your Apache Server
<?php
mail("test@gmail.com","Subject","Body","headers");
?>
Important
From Mail is Changed Option is Less Secure App off
<html>
<head> </head>
<style>
footer{
position:absolute;
width:100%;
bottom:0px;
}
img#im{
height: 110px;
width: 100%;
opacity: .4;
}
label#l {
position: relative;
top: 70px;
color: aliceblue;
font-size: 26px;
left: 10%;
}
@media only screen and (max-width : 1000px) {
.stellarnav > ul > li > a { padding: 20px 23px; }
}
li {
list-style-type: none;
}
#im{
height:31px;
}
.txt{
color: #fff;
margin-left: 2%;
font-weight: bold;
font-size: 25px;
line-height: 23px;
letter-spacing: -1px;
}
.t{
font-size: 4vw;
}
.cl{
background-color: #a2d5ac;
}
.inpt{
width: 100%;
box-sizing: border-box;
background-color: #88b991;
font-size: 18px;
line-height: 20px;
padding: 18px 24px;
display: inline-block;
vertical-align: top;
margin: 0 0 8px;
font-family: grad,serif;
color: #fff;
letter-spacing: 1px;
border: none;
}
::placeholder{
color: white;
opacity: 1;
font-style: italic;
}
#anc:focus{
background-color:#bce2c3
}
input[type=radio]{
display: none;
}
.lb{
color:#4a4949;
background-color:#bfe4c6;
padding: 6px 16px;
cursor: pointer;
border-radius:3px;
}
input[type=radio]:checked +.lb{
background-color: #88b991;
color: white;
}
.inpt{
width: 100%;
box-sizing: border-box;
background-color: #88b991;
font-size: 18px;
line-height: 20px;
padding: 18px 24px;
display: inline-block;
vertical-align: top;
margin: 0 0 8px;
font-family: grad,serif;
color: #fff;
letter-spacing: 1px;
border: 1px solid #00000021;
outline-color:#88b991;
margin: 0% 0% 3% 0%;
}
::placeholder{
font-style: italic;
color: #ffffff;
}
</style>
<tabel>
<form method="post" action="">
<tr>
<td> mail </td> <td> <input type="email" name="mail" placeholder=" enter mail " </td>
</tr>
<tr>
<td> subject </td> <td> <input type="text" name="subject" placeholder=" enter sunject " </td>
</tr>
<tr>
<td> body </td> <td> <input type="text" name="body" placeholder=" enter body " </td>
</tr>
<input type="submit" value="send" name="sub">
</form>
</tabel>
<?php
if(isset($_POST['sub'])){
$mail=$_POST['mail'];
$sub=$_POST['subject'];
$bdy=$_POST['body'];
mail($mail,"$sub,$body,"From: headet");
}
?>
<head> </head>
<style>
footer{
position:absolute;
width:100%;
bottom:0px;
}
img#im{
height: 110px;
width: 100%;
opacity: .4;
}
label#l {
position: relative;
top: 70px;
color: aliceblue;
font-size: 26px;
left: 10%;
}
@media only screen and (max-width : 1000px) {
.stellarnav > ul > li > a { padding: 20px 23px; }
}
li {
list-style-type: none;
}
#im{
height:31px;
}
.txt{
color: #fff;
margin-left: 2%;
font-weight: bold;
font-size: 25px;
line-height: 23px;
letter-spacing: -1px;
}
.t{
font-size: 4vw;
}
.cl{
background-color: #a2d5ac;
}
.inpt{
width: 100%;
box-sizing: border-box;
background-color: #88b991;
font-size: 18px;
line-height: 20px;
padding: 18px 24px;
display: inline-block;
vertical-align: top;
margin: 0 0 8px;
font-family: grad,serif;
color: #fff;
letter-spacing: 1px;
border: none;
}
::placeholder{
color: white;
opacity: 1;
font-style: italic;
}
#anc:focus{
background-color:#bce2c3
}
input[type=radio]{
display: none;
}
.lb{
color:#4a4949;
background-color:#bfe4c6;
padding: 6px 16px;
cursor: pointer;
border-radius:3px;
}
input[type=radio]:checked +.lb{
background-color: #88b991;
color: white;
}
.inpt{
width: 100%;
box-sizing: border-box;
background-color: #88b991;
font-size: 18px;
line-height: 20px;
padding: 18px 24px;
display: inline-block;
vertical-align: top;
margin: 0 0 8px;
font-family: grad,serif;
color: #fff;
letter-spacing: 1px;
border: 1px solid #00000021;
outline-color:#88b991;
margin: 0% 0% 3% 0%;
}
::placeholder{
font-style: italic;
color: #ffffff;
}
</style>
<tabel>
<form method="post" action="">
<tr>
<td> mail </td> <td> <input type="email" name="mail" placeholder=" enter mail " </td>
</tr>
<tr>
<td> subject </td> <td> <input type="text" name="subject" placeholder=" enter sunject " </td>
</tr>
<tr>
<td> body </td> <td> <input type="text" name="body" placeholder=" enter body " </td>
</tr>
<input type="submit" value="send" name="sub">
</form>
</tabel>
<?php
if(isset($_POST['sub'])){
$mail=$_POST['mail'];
$sub=$_POST['subject'];
$bdy=$_POST['body'];
mail($mail,"$sub,$body,"From: headet");
}
?>
Output :
No comments:
Post a Comment