I have a problem with sending emails via my domain. I have created a homepage with a input field and when you enter a valid email, my domain mail should send an email to the entered mail address.
I'm using phpmailer to do this, but for some reason these mails ending up as junk for outlook and hotmails. (It works fine with Gmail)
Have read alot stack posts about this problem, but haven't solved it yet. Have tried edit the From, Sender, ApplyTo, AddApplyTo and you name it. None seemed to work yet.
Script:
try {
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->Host = "smtp.unoeuro.com";
$mail->From = "from_mail@domain.com";
$mail->Sender = 'no-reply@domain.com';
$mail->setFrom('from_mail@domain.com', 'Name');
$mail->addReplyTo($_POST['email'], 'Name');
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Port = 25;
$mail->Username = "no-reply@domain.com";
$mail->Password = "password removed";
$mail->Subject = "Thanks for your interest!";
$mail->IsHTML(true);
$mail->Body='Thanks for your interest';
$address = $_POST['email'];
$mail->AddAddress($address, "Express");
$mail->Send();
}catch (phpmailerException $e) {
echo $e->errorMessage();
} catch (Exception $e) {
echo $e->getMessage();
}
Is there something wrong here in this script that can cause the problem?