Reputation: 21
The code below is my mail code that send passsword to mail but it does not go to yahoo and gmail i want to add STMP authentication to it how can i do that.
<?php
if(isset($_POST['submit'])){
If(empty($_POST['email'])) {
echo 'Please fill in the required fields!';
}else{
$email_to = $_POST['email'];
$sql = "SELECT statue FROM statue WHERE mail='$email_to'";
$result = mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
$rows = mysql_fetch_array($result);
$your_password = $rows['statue'];
$to = $email_to;
$subject = "Your password here";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .="from: Alinke <[email protected]>";
$messages ="Here is your password : $your_password";
$sentmail = mail($to,$subject,$messages,$headers);
}else{
echo 'your email can not be found in our database';
}
if($sentmail){
echo 'Your password has been sent to your email address.';
}else{
echo 'Cannot send password to your e-mail address';
}
}
}
?>
Upvotes: 2
Views: 238
Reputation: 449385
Swiftmailer is an advanced mailer class that can deal with authentication.
Here is an example for sending E-Mail through Google Mail with Swiftmailer.
Upvotes: 1