First of all, Before I made that post I am searching my problem for 10 days but I couldnt solved the issue,
My webpage I made it with php in 2013 was working perfectly in web right now, but in localhost Xampp the mail functions and php mailer is not working. Always it fails and displays
SMTP Connect error
My codes are shown below
<?php
include "baglan.php";
require 'admin/class.phpmailer.php';
$firma= $_POST['firma'];
$email= $_POST['email2'];
$iletisim= $_POST['iletisim'];
if( empty($firma) || empty($email) || empty($iletisim))
{
header("Location:iletisim.php");
}
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = 'smtp';
$mail->SMTPAuth = true;
$mail->Host = 'host adress'; // "ssl://smtp.gmail.com" didn't worked
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->Username = "user name adress";
$mail->Password = "pass";
$mail->CharSet = "UTF-8";
$mail->IsHTML(true); // if you are going to send HTML formatted emails
$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.
$mail->From = "mail adress";
$mail->FromName = "Tekleme Lastik";
$mail->addAddress("mail adress","User 1");
$mail->addCC("","User 2");
$mail->Subject = "İletisim Mesajı";
$mail->Body = "
<br> $iletisim </br>
<br> Firma: $firma </br>
<br> Email: $email </br>
";
if(!$mail->Send())
echo "Could not be sent<br />PHPMailer Error: " . $mail->ErrorInfo;
else
echo "Sent..";
ob_end_flush();
?>