Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

[Решено {yandex икой yandex}] Не отправляются письма выдает ошибку DATA not accepted from server


calibr
 Share

Recommended Posts

Кто знает  помогите. Не отправляются письма выдает ошибку Notice: Error: DATA not accepted from server! in /var/www/vhosts/u4273756.plsk.regruhosting.ru/neodimof/system/library/mail.php on line 380

утром все рилиило, вечером не рилииет уже. настройки не менял, днем гделал бэкап базы из админки. почтовый ящик на янгдексе, Version 1.5.4.1

Link to comment
Share on other sites


У меня привязана поли для домена на янгдекс...

 

Метод SMTP - выдаёт ошибку в 380 строке mail.php

Метод Машд - не шлет вообещё

 

Хотя всё рилиило

 

 

Как быть в икой ситуации? 

Link to comment
Share on other sites


Метод mail у меня принимает в админку и клиенту, но на почту прописанную в админке ничего не приходит, плюс на почту которая привязана к хостингу сыпяться сообещёния

 

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  [email protected]*******.ru
    Unknown user

Link to comment
Share on other sites


На двух разных хостингах и двух разных сайих одновременно проявилась ошибка при попытке отправки письма из магазина (воссиновление пароля, изменение ситуса заказа и т.д.)
 

Error: DATA not accepted from server! in /system/library/mail.php on line 385


Отправка игдет через Янгдекс почту для доменов, через SMTP. Причем на одном отправка игдет через ssl, на другом просто. Примерно несколько месяэтов до этого оба сайи рилиили нормально.

Link to comment
Share on other sites


Аналогичная проблема.
Метод отправки: SMTP
Поли привязана к янгдексу.
Ошибка: Notice: Error: DATA not accepted from server!  system/library/mail.php on line 380
 

Link to comment
Share on other sites


У меня икая же ошибка, но 156 строка.

До смены хостера все было ок. 

Пользовался smtp, ик же янгдекс.поли. 

 

А если вместо SMTP использовать Mail?

 

Пропотому чтовал вчера зналит: 

сивим mail отправку - в строке ниже пишем [email protected], это я вылиил из буржуйских гайдов, ошибка проподает, а вот сообещёния не доходят до почты.

Тире и заглавная буква обязательные

Link to comment
Share on other sites


А если вместо SMTP использовать Mail?

Да, им другая проблема, не на все ящики доходят письма. Видимо им надо настраивать и ковырять sendmail и тп.

При ошибке Ошибка: Notice: Error: DATA not accepted from server!  system/library/mail.php on line 380

Ответ янгдекс сервера:  501 5.1.7 Invalid address

P.S. Отправил запрос в сапорт янгдекса, жду ответ.

Link to comment
Share on other sites


Вижу не у одного меня эи проблема появилась.

вчера янегдекс  мне ответил следуюещёе:


Попробуйте указать порт 465, а в поле SMTP хост -- <<ssl://smtp.yandex.ru>>. Проверьте, повторяется ли проблема.

Пожалуйси, напишите нам о резульиих проверки в ответе на это письмо.

 

Отписался им что это не помогает.

Link to comment
Share on other sites


опробуйте указать порт 465, а в поле SMTP хост -- <<ssl://[/size]smtp.yandex.ru>>. Проверьте, повторяется ли проблема.[/size]

Пожалуйси, напишите нам о резульиих проверки в ответе на это письмо.[/size]

у меня на одном из сайтов ик и было указано и он точно икже пересил отправлять письма, ик что гдело явно не в этом.

Даже не помогают: перепотому чтор разных портов, авторизация на сайте под этим пользователем, смена пароля, изменение mail.php по совету с сайи турецкого опенкари, прыжки вокруг "$this->newline . $this->newline;" (это что бы вы не повторяли моих гдействий :)

Link to comment
Share on other sites


Не дождался я отвеи от янгдекса, но проблему решил!!! 
Открыл исходник письма которое приходит с этого ящика и обратил внимание, что в поле From между ?= и < стоит пробел.

Добавил пробел в 93-ей строке файла system/library/mail.php

Было ик:

$header .= 'From: ' . '=?UTF-8?B?' . base64_encode($this->sender) . '?=' . '<' . $this->from . '>' . $this->newline;
 

Сило вот ик:

$header .= 'From: ' . '=?UTF-8?B?' . base64_encode($this->sender) . '?= ' . '<' . $this->from . '>' . $this->newline;
 

И все зарилиило!
 

  • +1 3
Link to comment
Share on other sites


Не дождался я отвеи от янгдекса, но проблему решил!!! 

Открыл исходник письма которое приходит с этого ящика и обратил внимание, что в поле From между ?= и < стоит пробел.

Добавил пробел в 93-ей строке файла system/library/mail.php

Было ик:

$header .= 'From: ' . '=?UTF-8?B?' . base64_encode($this->sender) . '?=' . '<' . $this->from . '>' . $this->newline;
 

Сило вот ик:

$header .= 'From: ' . '=?UTF-8?B?' . base64_encode($this->sender) . '?= ' . '<' . $this->from . '>' . $this->newline;
 

И все зарилиило!

 

+ Посивил ssl na smtp ya.ru, сгделал порт 465, дное сгделал ик же как и izwork  - зарилиило.

  • +1 2
Link to comment
Share on other sites


2 часа убил на решение проблемы, ик и не решил!

 

спасипотому что Вам огромное за решение! это рилииет! :eek:  8-)

 

то же перелиил оф форум, ггде советовали \r \n править, новые линии, фаервол, антивирус, версия библиотек и т.п., и т.д.

 

ps а уже сообещёние в ТП янгдекс набрано было, чуть не отправил)))

Link to comment
Share on other sites


zwork спасипотому что! Все зарилиило!

Я решил проблему почты, опенкари и янгдекса ик:

В файле system/library/mail.php

#$header .= 'From: ' . '=?UTF-8?B?' . base64_encode($this->sender) . '?=' . '<' . $this->from . '>' . $this->newline;
                $header .= 'From: ' . $this->username . $this->newline;
#$header .= 'Reply-To: ' . '=?UTF-8?B?'. base64_encode($this->sender) . '?=' . '<' . $this->from . '>' . $this->newline;
                $header .= 'Reply-To: ' . $this->username . $this->newline;

  • +1 2
Link to comment
Share on other sites


  • 1 month later...

Добрый вечер. Не один из предложенных вариантов не помог. Поднимаю тему. Версия 1.5.5.1

 

Ошибка следующая 

 

Notice: Error: MAIL FROM not accepted from server! in /system/library/mail.php on line 290

Link to comment
Share on other sites


  • 4 weeks later...

тоже самое. Не один из вариантов не помогает. Версия 1.5.3.1

 

Notice: Error: MAIL FROM not accepted from server! in /home/251124/http/system/library/mail.php on line 290

 

Что гделать?

Link to comment
Share on other sites


тоже самое. Не один из вариантов не помогает. Версия 1.5.3.1[/size]

 

Notice: Error: MAIL FROM not accepted from server! in [/size]/home/251124/http/system/library/mail.php on line [/size]290

 

Что гделать?

 

 

Короче я просто удалил весь код и скопировал новый system/library/mail.php. Врогде рилииет:

 
<?php
final class Mail {
    protected $to;
    protected $from;
    protected $sender;
    protected $subject;
    protected $text;
    protected $html;
    protected $attachments = array();
    public $protocol = 'mail';
    public $hostname;
    public $username;
    public $password;
    public $port = 25;
    public $timeout = 5;
    public $newline = "\r\n";
    public $crlf = "\r\n";
    public $verp = FALSE;
    public $parameter = '';

    public function setTo($to) {
        $this->to = $to;
    }

    public function setFrom($from) {
        $this->from = $from;
    }

    public function addheader($header, $value) {
        $this->headers[$header] = $value;
    }

    public function setSender($sender) {
        $this->sender = html_entity_decode($sender);
    }

public function setSubject($subject) {
$this->subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
}

    public function setText($text) {
        $this->text = $text;

    }

    public function setHtml($html) {
        $this->html = $html;
    }

    public function addAttachment($file, $filename = '') {
        if (!$filename) {
            $filename = basename($file);
        }

        $this->attachments[] = array(
            'filename' => $filename,
            'file' => $file
        );
    }

    public function send() {
        if (!$this->to) {
            exit('Error: E-Mail to required!');
        }

        if (!$this->from) {
            exit('Error: E-Mail from required!');
        }

        if (!$this->sender) {
            exit('Error: E-Mail sender required!');
        }

        if (!$this->subject) {
            exit('Error: E-Mail subject required!');
        }

        if ((!$this->text) && (!$this->html)) {
            exit('Error: E-Mail message required!');
        }

        if (is_array($this->to)) {
            $to = implode(',', $this->to);
        } else {
            $to = $this->to;
        }

        $boundary = '----=_NextPart_' . md5(time());

        $header = '';

        if ($this->protocol != 'mail') {
            $header .= 'To: ' . $to . $this->newline;
            $header .= 'Subject: ' . $this->subject . $this->newline;
        }

        $header .= 'Date: ' . date("D, d M Y H:i:s O") . $this->newline;
        //$header .= 'From: "' . $this->sender . '" <' . $this->from . '>' . $this->newline;
        //$header .= 'From: ' . $this->sender . '<' . $this->from . '>' . $this->newline;
        $header .= 'From: ' . '=?UTF-8?B?'.base64_encode($this->sender).'?=' . '<' . $this->from . '>' . $this->newline;
        $header .= 'Reply-To: ' . $this->sender . '<' . $this->from . '>' . $this->newline;
        $header .= 'Return-Path: ' . $this->from . $this->newline;
        $header .= 'X-Mailer: PHP/' . phpversion() . $this->newline;
        $header .= 'MIME-Version: 1.0' . $this->newline;
        $header .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . $this->newline;
        $header .= 'Content-Transfer-Encoding: 8bit' . $this->newline;        
        $header .= $this->newline;

        if (!$this->html) {
            $message = '--' . $boundary . $this->newline;
            $message .= 'Content-Type: text/plain; charset="utf-8"' . $this->newline;
            $message .= 'Content-Transfer-Encoding: 8bit' . $this->newline . $this->newline;
            $message .= $this->text . $this->newline;
        } else {
            $message = '--' . $boundary . $this->newline;
            $message .= 'Content-Type: multipart/alternative; boundary="' . $boundary . '_alt"' . $this->newline . $this->newline;
            $message .= '--' . $boundary . '_alt' . $this->newline;
            $message .= '' . $this->newline;
            $message .= '' . $this->newline;

            if ($this->text) {
                $message .= $this->text . $this->newline;
            } else {
                $message .= '' . $this->newline;
            }

            $message .= '--' . $boundary . '_alt' . $this->newline;
            $message .= 'Content-Type: text/html; charset="utf-8"' . $this->newline;
            $message .= 'Content-Transfer-Encoding: 8bit' . $this->newline . $this->newline;
            $message .= $this->html . $this->newline;
            $message .= '--' . $boundary . '_alt--' . $this->newline;
        }

foreach ($this->attachments as $attachment) {
if (file_exists($attachment['file'])) {
$handle = fopen($attachment['file'], 'r');
$content = fread($handle, filesize($attachment['file']));

fclose($handle);

$message .= '--' . $boundary . $this->newline;
$message .= 'Content-Type: application/octetstream' . $this->newline;
$message .= 'Content-Transfer-Encoding: base64' . $this->newline;
$message .= 'Content-Disposition: attachment; filename="' . basename($attachment['filename']) . '"' . $this->newline;
$message .= 'Content-ID: <' . basename($attachment['filename']) . '>' . $this->newline . $this->newline;
$message .= chunk_split(base64_encode($content));
}
}

        $message .= '--' . $boundary . '--' . $this->newline;

        if ($this->protocol == 'mail') {
            ini_set('sendmail_from', $this->from);

            if ($this->parameter) {
                mail($to, '=?UTF-8?B?'.base64_encode($this->subject).'?=', $message, $header, $this->parameter);
            } else {
                mail($to, '=?UTF-8?B?'.base64_encode($this->subject).'?=', $message, $header);
            }

        } elseif ($this->protocol == 'smtp') {
            $handle = fsockopen($this->hostname, $this->port, $errno, $errstr, $this->timeout);

            if (!$handle) {
                error_log('Error: ' . $errstr . ' (' . $errno . ')');
            } else {
                if (substr(PHP_OS, 0, 3) != 'WIN') {
                    socket_set_timeout($handle, $this->timeout, 0);
                }

                while ($line = fgets($handle, 515)) {
                    if (substr($line, 3, 1) == ' ') {
                        break;
                    }
                }

                if (substr($this->hostname, 0, 3) == 'tls') {
                    fputs($handle, 'STARTTLS' . $this->crlf);

                    while ($line = fgets($handle, 515)) {
                        $reply .= $line;

                        if (substr($line, 3, 1) == ' ') {
                            break;
                        }
                    }

                    if (substr($reply, 0, 3) != 220) {
                        error_log('Error: STARTTLS not accepted from server!');
                    }
                }

                if (!empty($this->username) && !empty($this->password)) {
                    fputs($handle, 'EHLO ' . getenv('SERVER_NAME') . $this->crlf);

                    $reply = '';

                    while ($line = fgets($handle, 515)) {
                        $reply .= $line;

                        if (substr($line, 3, 1) == ' ') {
                            break;
                        }
                    }

                    if (substr($reply, 0, 3) != 250) {
                        error_log('Error: EHLO not accepted from server!');
                    }

                    fputs($handle, 'AUTH LOGIN' . $this->crlf);

                    $reply = '';

                    while ($line = fgets($handle, 515)) {
                        $reply .= $line;

                        if (substr($line, 3, 1) == ' ') {
                            break;
                        }
                    }

                    if (substr($reply, 0, 3) != 334) {
                        error_log('Error: AUTH LOGIN not accepted from server!');
                    }

                    fputs($handle, base64_encode($this->username) . $this->crlf);

                    $reply = '';

                    while ($line = fgets($handle, 515)) {
                        $reply .= $line;

                        if (substr($line, 3, 1) == ' ') {
                            break;
                        }
                    }

                    if (substr($reply, 0, 3) != 334) {
                        error_log('Error: Username not accepted from server!');
                    }

                    fputs($handle, base64_encode($this->password) . $this->crlf);

                    $reply = '';

                    while ($line = fgets($handle, 515)) {
                        $reply .= $line;

                        if (substr($line, 3, 1) == ' ') {
                            break;
                        }
                    }

                    if (substr($reply, 0, 3) != 235) {
                        error_log('Error: Password not accepted from server!');
                    }
                } else {
                    fputs($handle, 'HELO ' . getenv('SERVER_NAME') . $this->crlf);

                    $reply = '';

                    while ($line = fgets($handle, 515)) {
                        $reply .= $line;

                        if (substr($line, 3, 1) == ' ') {
                            break;
                        }
                    }

                    if (substr($reply, 0, 3) != 250) {
                        error_log('Error: HELO not accepted from server!');
                    }
                }

                if ($this->verp) {
                    fputs($handle, 'MAIL FROM: <' . $this->username . '>XVERP' . $this->crlf);
                } else {
                    fputs($handle, 'MAIL FROM: <' . $this->username . '>' . $this->crlf);
                }

                $reply = '';

                while ($line = fgets($handle, 515)) {
                    $reply .= $line;

                    if (substr($line, 3, 1) == ' ') {
                        break;
                    }
                }

                if (substr($reply, 0, 3) != 250) {
                    error_log('Error: MAIL FROM not accepted from server!');
                }

                if (!is_array($this->to)) {
                    fputs($handle, 'RCPT TO: <' . $this->to . '>' . $this->crlf);

                    $reply = '';

                    while ($line = fgets($handle, 515)) {
                        $reply .= $line;

                        if (substr($line, 3, 1) == ' ') {
                            break;
                        }
                    }

                    if ((substr($reply, 0, 3) != 250) && (substr($reply, 0, 3) != 251)) {
                        error_log('Error: RCPT TO not accepted from server!');
                    }
                } else {
                    foreach ($this->to as $recipient) {
                        fputs($handle, 'RCPT TO: <' . $recipient . '>' . $this->crlf);

                        $reply = '';

                        while ($line = fgets($handle, 515)) {
                            $reply .= $line;

                            if (substr($line, 3, 1) == ' ') {
                                break;
                            }
                        }

                        if ((substr($reply, 0, 3) != 250) && (substr($reply, 0, 3) != 251)) {
                            error_log('Error: RCPT TO not accepted from server!');
                        }
                    }
                }

                fputs($handle, 'DATA' . $this->crlf);

                $reply = '';

                while ($line = fgets($handle, 515)) {
                    $reply .= $line;

                    if (substr($line, 3, 1) == ' ') {
                        break;
                    }
                }

                if (substr($reply, 0, 3) != 354) {
                    error_log('Error: DATA not accepted from server!');
                }

                fputs($handle, $header . $message . $this->crlf);
                fputs($handle, '.' . $this->crlf);

                $reply = '';

                while ($line = fgets($handle, 515)) {
                    $reply .= $line;

                    if (substr($line, 3, 1) == ' ') {
                        break;
                    }
                }

                if (substr($reply, 0, 3) != 250) {
                    error_log('Error: DATA not accepted from server!');
                }

                fputs($handle, 'QUIT' . $this->crlf);

                $reply = '';

                while ($line = fgets($handle, 515)) {
                    $reply .= $line;

                    if (substr($line, 3, 1) == ' ') {
                        break;
                    }
                }

                if (substr($reply, 0, 3) != 221) {
                    error_log('Error: QUIT not accepted from server!');
                }

                fclose($handle);
            }
        }
    }
}
?>
Edited by afwollis
[spoiler][code]
  • +1 2
Link to comment
Share on other sites


  • 1 month later...

1. Ошибка DATA not accepted from server , которая возникает при регистрации покупателя и приводит к неотправлению писем как админу, ик и покупателю, исправляется следующим обвместе :

в файле catalog\model\account\customer.php

 

иещём две строки

$mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));

и обе исправляем следующим обвместе

$mail->setText(strip_tags(html_entity_decode($message, ENT_QUOTES, 'UTF-8')));

2. Ошибка при отправке сообещёния со странички "Связаться с нами" вызвана тем, что происходит попытка отправки письма с адреса покупателя, а не вашего адреса. Поэтому в файле catalog\controller\information\contact.php необходимо исправить

$mail->setTo($this->request->post['email']);

на

$mail->setTo($this->config->get('config_email'));
  • +1 1
Link to comment
Share on other sites


  • 1 month later...

 

2. Ошибка при отправке сообещёния со странички "Связаться с нами" вызвана тем, что происходит попытка отправки письма с адреса покупателя, а не вашего адреса. Поэтому в файле catalog\controller\information\contact.php необходимо исправить

$mail->setTo($this->request->post['email']);

на

$mail->setTo($this->config->get('config_email'));

 

 

 

Спасипотому что. Рилииет, только не:

$mail->setTo($this->config->get('config_email'));

а точнее:

$mail->setFrom($this->config->get('config_email')); 
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.