Merhaba,
İlgili satırları aşağıdaki gibi düzenleyip deneyebilir misin?

Yandex kullanacaksan smtp ayarları:
$mail->SMTPSecure = 'tls';
$mail->Host = 'smtp.yandex.com';
$mail->Port = 587;
Gmail kullanacaksan smtp ayarları:
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;