Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

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


calibr

Recommended Posts

  • 3 weeks later...

 

 

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

 <?phpfinal 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);            }        }    }}?>

 

Cпасибо, вопрос решился.

Надіслати
Поділитися на інших сайтах


  • 4 months later...

Есть ли простое решение без замены целого файла ?

Надіслати
Поділитися на інших сайтах

  • 3 weeks later...

 

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

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

а точнее:

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

 

В этом случае действительно теряется мэйл отправителя.

 

Нашел альтернативный способ решения проблемы:

Я меня к сайту прибита "почта для домена" от Яндекса. И в админке Опенкарта для почты выбрано SMTP (smtp.yandex.ru и т.д.).

В такой конфигурации форма обратной связи пытается отправить сообщение с адреса покупателя через SMTP и естественно терпит неудачу.

Для формы обратной связи нужен протокол "mail".

 

Поэтому в файле catalog\controller\information\contact.php я в лоб указал 

Цитирую код начиная с 11-й строки:

 

$mail = new Mail();
//$mail->protocol = $this->config->get('config_mail_protocol');
$mail->protocol = 'mail'; // - принудительный выбор протокола
 
Все работает как часики и не нужно тревожить саппорт яндекса - у них и так много проблем.

 

Надіслати
Поділитися на інших сайтах

 

 

Короче я просто удалил весь код и скопировал новый 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);
            }
        }
    }
}
?>

 

Помогло

Надіслати
Поділитися на інших сайтах

 

В этом случае действительно теряется мэйл отправителя.

 

Нашел альтернативный способ решения проблемы:

Я меня к сайту прибита "почта для домена" от Яндекса. И в админке Опенкарта для почты выбрано SMTP (smtp.yandex.ru и т.д.).

В такой конфигурации форма обратной связи пытается отправить сообщение с адреса покупателя через SMTP и естественно терпит неудачу.

Для формы обратной связи нужен протокол "mail".

 

Поэтому в файле catalog\controller\information\contact.php я в лоб указал 

Цитирую код начиная с 11-й строки:

 

$mail = new Mail();
//$mail->protocol = $this->config->get('config_mail_protocol');
$mail->protocol = 'mail'; // - принудительный выбор протокола
 
Все работает как часики и не нужно тревожить саппорт яндекса - у них и так много проблем.

 

При отправке письма ошибку не говорит, в логах тоже все чисто, однако на почту ничего не приходит.

Надіслати
Поділитися на інших сайтах


При отправке письма ошибку не говорит, в логах тоже все чисто, однако на почту ничего не приходит.

Нужно смотреть спам. если там нет то параметры mail. Возможно, что у меня все ок из-за того, что хоть почта у меня от Яши. но на хостинге стоит постфикс с настроеным мэйлом для домена. экспериментировать и отключать его не буду - сайт "боевой"

Надіслати
Поділитися на інших сайтах

Нужно смотреть спам. если там нет то параметры mail. Возможно, что у меня все ок из-за того, что хоть почта у меня от Яши. но на хостинге стоит постфикс с настроеным мэйлом для домена. экспериментировать и отключать его не буду - сайт "боевой"

Ну видимо поэтому и приходит.

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

Надіслати
Поділитися на інших сайтах


  • 2 weeks later...
  • 4 weeks later...

Пока использовал почту на своем виртуальном сервере было все ОК.

Затем решил перейти на biz.mail.ru. Установил SMTP протокол, прописал настройки. Уведомления о заказах работают.

 

Но не работает форма обратной связи. Письмо никуда не приходит. 

 

 

РЕШЕНО:

 

В файле \catalog\controller\information\contact.php заменить:
$mail->setFrom($this->request->post['email']);
$mail->setSender($this->request->post['name']);
 

НА это:

$mail->setFrom($this->config->get('config_email'));
$mail->setSender($this->request->post['email']);

Надіслати
Поділитися на інших сайтах


  • 3 months later...
  • 2 weeks later...

Сделал как в посте  stb45, ошибки исчезли, но письма по прежнему не приходят ни при регистрации не при других действиях с уведомлениями на почту. Пользую яндекс пдд.

Пробовал и mail и smtp результат все время один и тот же. Действие завершается, письмо не приходит.

 

Проблема решена. Новое правило яндекса, что ящик обязательно должен пройти дорегистрацию, в противном случае он не работает. Зашел в веб интерфейс ящика, заполнил данные и все заработало. Но бещ соыета от stb45 все равно бы ничего не работало, потому что вылезали ошибки. Поэтому спасибо!

Надіслати
Поділитися на інших сайтах


Перестали приходить письма о новых заказах, не приходят на почту админа и на почту клиента.

Началось со вчерашнего дня, до этого все работало, в логах вот что:

 

2014-12-25 10:54:54 - PHP Warning:  fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to ssl://smtp.yandex.ru:465 (Connection timed out) in /home/m/site/ekip/public_html/system/library/mail.php on line 153
2014-12-25 10:54:54 - PHP Notice:  Error: Connection timed out (110) in /home/m/site/ekip/public_html/system/library/mail.php on line 156
2014-12-25 10:57:25 - PHP Warning:  fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to ssl://smtp.yandex.ru:465 (Connection timed out) in /home/m/site/ekip/public_html/system/library/mail.php on line 153
2014-12-25 10:57:25 - PHP Notice:  Error: Connection timed out (110) in /home/m/site/ekip/public_html/system/library/mail.php on line 156
2014-12-25 13:07:08 - PHP Warning:  fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to ssl://smtp.yandex.ru:465 (Connection timed out) in /home/m/site/ekip/public_html/system/library/mail.php on line 153
2014-12-25 13:07:08 - PHP Notice:  Error: Connection timed out (110) in /home/m/site/ekip/public_html/system/library/mail.php on line 156
 

Надіслати
Поділитися на інших сайтах


google говорит, что на хабре упоминают возможность использовать порты 25 и 587 для ssl-smtp-yandex вместо 465, и что сам яндекс "это не афиширует":

На 465 порте живёт устаревший SMTPS, который подразумевает установку защищённого содениня сразу. STARTTLS работает на портах 25 и 587, фиг знает почему Яндекс это не афиширует.

__habrahabr.ru/post/237899/#comment_8132881

попробуйте их в настройке

Надіслати
Поділитися на інших сайтах

google говорит, что на хабре упоминают возможность использовать порты 25 и 587 для ssl-smtp-yandex вместо 465, и что сам яндекс "это не афиширует":

попробуйте их в настройке

Пробовал, ещё больше ошибок

Надіслати
Поділитися на інших сайтах


2014-12-25 15:42:23 - PHP Warning:  fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to ssl://smtp.yandex.ru:587 (Connection timed out) in /home/m/site/ekip/public_html/system/library/mail.php on line 153

2014-12-25 15:42:23 - PHP Notice:  Error: Connection timed out (110) in /home/m/site/ekip/public_html/system/library/mail.php on line 156

Змінено користувачем afwollis
не нужен нам ваш файл
Надіслати
Поділитися на інших сайтах


ошибки те же самые.

к чему было

Пробовал, ещё больше ошибок

?

верните прежний порт и пинайте поддержку яндекса.

Надіслати
Поділитися на інших сайтах

ошибки те же самые.

к чему было

?

верните прежний порт и пинайте поддержку яндекса.

Яндекс вот что ответил:

 

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

 

Где взять этот tcpdump ?

Надіслати
Поділитися на інших сайтах


  • 3 weeks later...

Ребята у меня похожая проблема:

 

2015-01-11 0:09:40 - PHP Notice:  Error: RCPT TO not accepted from server! in /share/CACHEDEV1_DATA/.qpkg/OpenCart/web/system/library/mail.php on line 308

 

Только разница в том, что письма ходят, а проблема возникает при попытке написать обращение во вкладке связаться с нами. Как проблему решать ума не дам, прошу помочь.

Надіслати
Поділитися на інших сайтах


Ребята у меня похожая проблема:

 

2015-01-11 0:09:40 - PHP Notice:  Error: RCPT TO not accepted from server! in /share/CACHEDEV1_DATA/.qpkg/OpenCart/web/system/library/mail.php on line 308

 

Только разница в том, что письма ходят, а проблема возникает при попытке написать обращение во вкладке связаться с нами. Как проблему решать ума не дам, прошу помочь.

Проблему решил путем внесения изменений в contact.php и mail.php: http://www.expertsos.net/blog/opencart-fixing-notice-error-rcpt-to-not-accepted-from-server/

 

Позволю сделать копирайт решения:

Opencart 1.5 Fix
  • First edit the file catalog/controller/information/contact.php

    Look for line:

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

    in my version it is line 20

    Change it to:

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

    What this will do is set the FROM field to be the same as your shop’s main email address.

    You can hardcode (but I wouldn’t recommend it) an email adress here if you want by changing this line to ie:

    $mail->setFrom('moc.niamodym@pohs');

  • Now find the line:

    $mail->setSender($this->request->post['name']);

    It should be below the line we just edited or somwhere near.

    Change it to:

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

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

    What this will do is set your client’s email provided by him in the contact form as reply-to email, so that you’re able to respond automatically to contact form messages by clicking on Reply button.

    It is also setting your shop email address as sender’s name.

  • OK so now we need to edit system/library/mail.php file

    In the beginning you will have line:

    protected $subject;

    Just add this before it:

    protected $replyto;

  • Find line:

    public function setSender($sender) {

    and before it add:

    public function setReplyTo($reply_to) {

    $this->replyto = html_entity_decode($reply_to, ENT_QUOTES, 'UTF-8');

    }

    What we did here is to add REPLY-TO function which is missing in 1.5 (but is present in 2.0) and allows us to set different reply-to addresses than FROM address.

  • Finally find this line:

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

    and change it to:

    $header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->replyto) . '?=' . ' <' . $this->replyto . '>' . $this->newline;

    Here we are correcting the way reply-to address is set (it will use the email address your client introduced in the contact form).

    And that’s it!

Opencart 2.0 fix

It is simplier to change in the newest version of OC because there is already a funciton to set Reply-To address.

  • First edit the file catalog/controller/information/contact.php

    Look for line:

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

    in my version it is line 20

    Change it to:

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

    What this will do is set the FROM field to be the same as your shop’s main email address.

    You can hardcode (but I wouldn’t recommend it) an email adress here if you want by changing this line to ie:

    $mail->setFrom('moc.niamodym@pohs');

  • Now find this line:

    $mail->setSender($this->request->post['name']);

    It should be below the line we just edited or somwhere around.

    Change it to:

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

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

    What this will do is set your client’s email provided by him in the contact form as reply-to email, so that you’re able to respond automatically to contact form messages by clicking on Reply button.

    It is also setting your shop email address as sender’s name.

  • No we need to edit system/library/mail.php file

    You just need to change one line:

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

    change it to:

    $header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->replyto) . '?=' . ' <' . $this->replyto . '>' . $this->newline;

    Here we are correcting the way reply-to address is set (it will use the email address your client introduced in the contact form).

    Refresh your contact form and try sending a test email.

Надіслати
Поділитися на інших сайтах


  • 9 months later...

Пока использовал почту на своем виртуальном сервере было все ОК.

Затем решил перейти на biz.mail.ru. Установил SMTP протокол, прописал настройки. Уведомления о заказах работают.

 

Но не работает форма обратной связи. Письмо никуда не приходит. 

 

 

РЕШЕНО:

 

В файле \catalog\controller\information\contact.php заменить:

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

$mail->setSender($this->request->post['name']);

 

НА это:

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

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

 

Благодарю, помогло на  Ubuntu 14.04.3 LTS+LAMP+OpenCart Version 2.1.0.1 (rs.2)

Змінено користувачем Salt
Надіслати
Поділитися на інших сайтах


Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз

×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.