In a PHP application during the sign up step, I'm sending an email with a verfication link to the user. I'm using XAMPP in localhost to serve the page, and my database is in another device but in the same network. When I fill the form and hit the sign up button, I get a success message, the database is updated but no email is received to my address. I've searched for answers and found out that I had to configure php.ini
and sendmail.ini
properly in order for it work and I did that as well but still no mail is send. Can anyone explain why is this happening? Below are the configurations of both php.ini
and sendmail.ini
as there is no problem with my signup.php since the database is updating.
sendmail.ini
[sendmail]
smtp_server= smtp.mail.yahoo.com
smtp_port=465
smtp_ssl=ssl
;default_domain=mydomain.com
error_logfile=error.log
;debug_logfile=debug.log
auth_username=mymail@yahoo.com
auth_password=mypassword
pop3_server=
pop3_username=
pop3_password=
force_sender=mymail@yahoo.com
force_recipient=
hostname=
php.ini
[mail function]
SMTP= smtp.mail.yahoo.com
smtp_port=465
sendmail_from = mymail@yahoo.com
sendmail_path = "\"C:\Users\GMKRG\Desktop\xampp\sendmail\sendmail.exe" -t"
;mail.force_extra_parameters =
mail.add_x_header=Off
mail.log = "\"C:\Users\GMKRG\Desktop\xampp\sendmail\error.txt"
;mail.log = syslog
I've also configured my yahoo account to accept mails from less secure apps but still no mail received. Thanks in advance.
EDIT: Below is the php mail function in case it helps more.
$email = mysqli_real_escape_string($connection, $mailString);
$emailBody = "Please click on the link below to activate your account:\n\n";
$emailBody .= "localhost/website/activate.php?email=" . urlencode($email) . "&key=$activationKey";
if(mail($email, 'Confirm your registration', $emailBody, 'From:'.'myaddress@yahoo.com')){
echo "<div class='alert alert-success'>Thank you for registering. A
confirmation email has been sent to $email. Please click on the
activation link inside it to activate your account.</div>";
}