V
V
Vyacheslav Mulyukin2015-06-24 22:05:54
PHP
Vyacheslav Mulyukin, 2015-06-24 22:05:54

Why does this script not send a letter to the mail (working script)?

Here is my script
Everything is on the hosting ru center
When submitting the form, there is an endless loading
. It is necessary to send from Yandex mail to another mail.
Help fix the script

<?php 
$mail = new PHPMailer;
//будем отравлять письмо через СМТП сервер
$mail->isSMTP();
//хост
$mail->Host = 'smtp.yandex.ru';
//требует ли СМТП сервер авторизацию/идентификацию
$mail->SMTPAuth = true;
// логин от вашей почты
$mail->Username = '[email protected]';
// пароль от почтового ящика
$mail->Password = 'secret';
//указываем способ шифромания сервера
$mail->SMTPSecure = 'ssl';
//указываем порт СМТП сервера
$mail->Port = '465';

//указываем кодировку для письма
$mail->CharSet = 'UTF-8';
//информация от кого отправлено письмо
$mail->From = '[email protected]';
$mail->FromName = 'Админ';
$mail->addAddress('[email protected]');

$mail->isHTML(true);

$mail->Subject = 'Тема письма';
$mail->Body = 'Текст можно с хтмл';

if( $mail->send() ){
   echo 'Письмо отправлено';
}else{
   echo 'Письмо не может быть отправлено. ';
   echo 'Ошибка: ' . $mail->ErrorInfo;
}
?>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Rikcon, 2015-06-24
@Rikcon

Author, URGENT, you burned your account password, I just managed to log into it. REMOVE AND CHANGE IT.

X
xmoonlight, 2015-06-24
@xmoonlight

perhaps the SSL module is not enabled or not configured on the hosting

D
d1KdaT, 2015-06-24
@d1KdaT

Try replacing Host with "ssl://smtp.yandex.ru"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question