function mailgonder()
{
$mail = new PHPMailer();
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'smtp.yandex.com'; //Set the SMTP server to send
$mail->SMTPAuth = true; //Enable SMTP
$mail->Username = '******.com.tr'; //SMTP
$mail->Password = '******'; //SMTP password
$mail->SMTPSecure = 'tls';
$mail->Port = 587; //TCP port to connect to;
//Recipients
$mail->setFrom('com.tr', 'Web Mail');
$mail->addAddress('******.com.tr'); //Name is optional
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = "Ad:" . $_POST["txtAd"] . "Mail:" . $_POST["txtEmail"];
$mail->Body = $_POST["txtMesaj"];
$mail->send();
}
if (mailgonder()==true) {
echo "<script>Swal.fire({title: 'Başarılı!', text: 'Mesajınız Başarıyla Gönderildi', icon: 'success',
confirmButtonText: 'Tamam'})</script>";
}else{
echo "Başarısız";
}