@jheka524
Web-developer

Почему phpMailer не отправляет почту по smtp локально?

private function sendInternal($to, $subject, $html, $text, $from = null)
    {
        $mail = new \PHPMailer;
        if ($from == null) {
            $from = 'noreply@test.com';
        }
        $mail->SMTPDebug = 4;
        $mailsConfig = conf('mail');
        if ($mailsConfig['isSMTP']) {
            $mail->isSMTP();  // tell the class to use SMTP
            $mail->SMTPAuth = $mailsConfig['SMTPAuth']; // enable SMTP authentication

            // $mail->SMTPSecure = 'ssl';

            $mail->Port = 465; // set the SMTP port
            $mail->Host = "smtp.gmail.com"; // SMTP server
            $mail->Username = $mailsConfig['Username']; // SMTP account username
            $mail->Password = $mailsConfig['Password'];     // SMTP account password
        }
        $mail->setFrom($from);
        //Set an alternative reply-to address
        $mail->addReplyTo($from);
        //Set who the message is to be sent to
        $mail->addAddress($to);
        //Set the subject line
        $mail->Subject = $subject;
        //Read an HTML message body from an external file, convert referenced images to embedded,
        //convert HTML into a basic plain-text alternative body
        $mail->msgHTML($html);

        //Replace the plain text body with one created manually
        $mail->AltBody = $text;

        if (!$mail->send()) {
            throw new \Exception($mail->ErrorInfo);
            return false;
        } else {
            return true;
        }

Ошибка выглядит след. образом
5a7c295a88eac454208668.png
Если закомментировать smpt блок, ошибка выглядит след. образом
5a7c29d954885916027623.png

Скачивал sendmail.zip, который разархивировал в "C:/wamp64/".
sendmail.ini выглядит след образом

smtp_server=smtp.gmail.com
smtp_port=465
smtp_ssl=ssl
default_domain=localhost
error_logfile=error.log
debug_logfile=debug.log
auth_username={MYGMAIL}
auth_password={MYGMAILPASS}
pop3_server=
pop3_username=
pop3_password=
force_sender=
force_recipient=
hostname=localhost

php.ini который находится в папке с apache настроил sendmail_path
username и password указываю правильно 100%
И всеравно ошибка. Что не так, как исправить?
  • Вопрос задан
  • 155 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
YCLIENTS Москва
от 200 000 до 350 000 ₽
Ведисофт Екатеринбург
от 25 000 ₽
ИТЦ Аусферр Магнитогорск
от 100 000 до 160 000 ₽
25 апр. 2024, в 11:02
5000 руб./за проект
25 апр. 2024, в 10:42
150000 руб./за проект
25 апр. 2024, в 10:41
2000 руб./за проект