So I want to send an email from gmail address to yahoo address. It's working, but when I open the yahoo mail, it doesn't recognize the message I've sent from the gmail address. For example, I have a button for login confirmation that you have to press when you receive the mail. When I send to a gmail address, you can press the button, but when it comes to yahoo address.. nope :(. Any ideas why? And how to fix this?
$sentTo = $email;
$message = "Confirm registration";
$mail = new PHPMailer;
//$mail->SMTPDebug = 2;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'myusername'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->Port = 587; //Set the SMTP port number - 587 for authenticated TLS
$mail->setFrom('myusername@gmail.com', 'WEBSITE'); //Set who the message is to be sent from
$mail->addAddress($sentTo); // Add a recipient
$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = "Travel Smart - Confirm Registration - ";
$mail->Body = "<div style='padding: 10px; border-radius: 10px; height: auto; background-image:linear-gradient(to right, rgba(287, 202, 192), rgba(142, 65, 98));opacity:0.8;'><h2 style='font-family:cursive'> WELCOME! </h2> <br> <a href='localhost/log.php?unique_id=$ran_id'><button style='color:white; background:black; pointer: cursor; padding: 10px; border-radius: 20px;'>". $message."</button></a><br></div>";
$mail->AltBody = $message;
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}