Here is my code
$subject = 'Verification code';
$message = '
<html>
<head>
<title>Here is your Verification Code</title>
</head>
<body>
<p>Please use this verification code this is a one time verification '. $fourRandomDigit.'</p>
</body>
</html>
';
//Server settings
$mail->isSMTP();
$mail->Host = 'smtp.test.io';
$mail->SMTPAuth = true;
$mail->Port = 421;
$mail->Username = 'name';
$mail->Password = 'pass';
//Recipients
$mail->setFrom('from@sof.com', 'name');
$mail->addAddress('to@sof.com'); //Name is optional
$mail->addReplyTo('from@sof.com', 'name');
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $message;
if (!$mail->Send()) {
echo "Error while sending Email.";
} else {
echo "Email sent successfully";
}
My smtp server shows that the mail is sent but the mails are not being received, also the "Email sent successfully" is being printed,so i am a bit confused where am i wrong
Thanks in advance