UPDATE: I've managed to find solutions for questions, asked earlier. Everything seems to work, no mistakes are shown, but I don't receive the emails
Port 465 is open and I am able to telnet it. From the advices that I've found on stackoverflow I tried to check SMTP server logging, but after installing IIS in order to enable logging, my Apache server stopped working-> I tried to change ports, but it didn't help. I got stuck...
<?php
require 'PHPmailer\class.phpmailer.php';
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->Port = 465;
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'test@gmail.com';
$mail->Password = 'test';
$mail->SMTPSecure = 'ssl';
if (!empty($_GET)){
$errors=array();
$email = isset($_GET['email']) ? $_GET['email'] : '';
$name = isset($_GET['name']) ? $_GET['name'] : '';
$message = isset($_GET['message']) ? $_GET['message'] : '';
if (empty($name) || empty($email) || empty($message)){
$errors[]='All fields are required!';
}else{
if (!filter_var("$email", FILTER_VALIDATE_EMAIL)){
$errors[]='The email is not valid!';
}
}
if (empty($errors)){
$mail->From = $email;
$mail->FromName = $name;
$mail->IsHTML(true);
$mail->Body = $message;
$mail->Subject ="From IMDB";
$mail->IsHTML(true);
$result = $mail->Send();
if(!$result) {
echo $mail->ErrorInfo;
} else {
header('Location:contactForm.php?sent');
exit();
}
}
}
?>
I'll attach piece of php.ini as well:
smtp_port = 465;
auth_username = test@gmail.com
auth_password = test
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
Thanks for help