I working on a email activation system.The system echo,email is sent,the mail function is work properly,but i cant receive any email form it
i do the certain configuration in php.ini
;SMTP = smtp.gmail.com
sendmail_from = horsepowerbank@gmail.com
auth_username=horsepowerbankgmail.com
auth_password=XXXXXX
sendmail_path ="\"C:\wamp\sendmail\sendmail.exe\" -t"
i testing the function by this php files
send-mail.php
<?php
$to = 'mineble2014@gmail.com';
$subject = 'Testing sendmail.exe';
$message = 'Hi, you just received an email using sendmail!';
$headers = 'From: horsepowerbank@gmail.com' . "\r\n" .
'Reply-To: horsepowerbank@gmail.com' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($to, $subject, $message, $headers))
echo "Email sent";
else
echo "Email sending failed";
?>
The mail() function is working well,and it echo "Email send"..but i check in mineble2014@gmail.com,I cant see any email in inbox,spam etc...
And i also want to send the activation email to the user for them to activate their account,the code run successfully,but didnt receive any email..here is my code at register.php
register.php
<?php
//create random number
$code = rand("11111111,99999999");
//declare variable to send the email activation
$to = $email;
$subject = "Activate your account";
$header = "From watevershit.com non-reply";
$body ="Hello,$username please activate your account by clink the link below or paste it in url bar in your browse \n\n http://watevershit/activate.php?code=$code";
//HASHING THE PASSWORD
$password = md5($password);
$queryinsert= "INSERT INTO user(Username,Password,Email) VALUES ('$username','$password','$email')";
mysqli_query($con,$queryinsert);
if(!mail($to,$subject,$header,$body)){
echo "We are sorry,we cant registered you at this moment";
}else{
echo" You are registered successfully,please check your email ($email) to activate your account.Thank you";
}
header("Location:login.php");
?>
and the $code i set above it doesnt generate anything,and just 0 in the database..so guys,any idea about this??