- [SOLVED] — Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
- Re: Account — Add an Affiliate (SMTP ERROR)
[SOLVED] — Account — Add an Affiliate (SMTP ERROR)
I can’t see what would cause it. Is it an issue with my SMTP? It’s working for everything else. Sending emails for when accounts are made, orders placed, etc. Just struggling with the affiliate add mail.
It is being added to the database correctly also despite the error.
Re: Account — Add an Affiliate (SMTP ERROR)
Post by straightlight » Sat Apr 04, 2020 8:36 pm
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Re: Account — Add an Affiliate (SMTP ERROR)
Post by scottyboyyy » Sat Apr 04, 2020 8:47 pm
I just checked and I am using «ssl://». I went through cpanel and it seems correct host.
Mail is working for everything else, even working for affiliate when added through affiliate/register. The only issue is when added through account/affiliate.
Re: Account — Add an Affiliate (SMTP ERROR)
Post by straightlight » Sat Apr 04, 2020 8:59 pm
The following has already been fixed on Github, however. In catalog/controller/mail/affiliate.php file,
$mail->setSubject(sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'))); $mail->setText($this->load->view('mail/affiliate', $data));
$mail->setSubject(html_entity_decode(sprintf($this->language->get('text_subject'), $this->config->get('config_name')), ENT_QUOTES, 'UTF-8')); $mail->setHtml($this->load->view('mail/affiliate', $data));
$mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')); $mail->setSubject(html_entity_decode($this->language->get('text_new_affiliate'), ENT_QUOTES, 'UTF-8')); $mail->setText($this->load->view('mail/affiliate_alert', $data));
$mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')); $mail->setSubject($this->language->get('text_new_affiliate')); $mail->setHtml($this->load->view('mail/affiliate_alert', $data));
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Re: Account — Add an Affiliate (SMTP ERROR)
Post by scottyboyyy » Sat Apr 04, 2020 9:15 pm
Thanks for sending that. I made the changes, but same exact error
The setup is working for everything else.
This is line 328 of the smtp, what causes substr($reply, 0, 3) not to be 250? And what does that mean?
Re: Account — Add an Affiliate (SMTP ERROR)
Post by straightlight » Sat Apr 04, 2020 9:21 pm
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Re: Account — Add an Affiliate (SMTP ERROR)
Post by scottyboyyy » Sat Apr 04, 2020 9:42 pm
Here is my setup beside a screenshot of the cpanel instructions.
Re: Account — Add an Affiliate (SMTP ERROR)
Post by straightlight » Sat Apr 04, 2020 9:55 pm
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Re: Account — Add an Affiliate (SMTP ERROR)
Post by letxobnav » Sat Apr 04, 2020 9:55 pm
affiliate mail views are text not html.
“Data security is paramount at [. ], and we are committed to protecting the privacy of anyone who is associated with our [. ]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Re: Account — Add an Affiliate (SMTP ERROR)
Post by straightlight » Sat Apr 04, 2020 9:57 pm
I would not suggest to apply the above solution if your store is running live. Also take note that text email mode was implicit on the first post prior to change it to html emails.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Re: Account — Add an Affiliate (SMTP ERROR)
Post by scottyboyyy » Sat Apr 04, 2020 10:02 pm
I just tested with and without, to see if the error changed but it was the same whether checked or not.
affiliate mail views are text not html.
must be null as it’s not changing the error message. Why would it return null? Could this be the issue?
Re: Account — Add an Affiliate (SMTP ERROR)
Post by straightlight » Sat Apr 04, 2020 10:05 pm
must be null as it’s not changing the error message. Why would it return null? Could this be the issue?
Your mail parameter is also empty in the form. Some servers still may require you enter your outgoing mail. address in the Mail Parameter of your OC Mail form.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Re: Account — Add an Affiliate (SMTP ERROR)
Post by scottyboyyy » Sat Apr 04, 2020 10:13 pm
must be null as it’s not changing the error message. Why would it return null? Could this be the issue?
Your mail parameter is also empty in the form. Some servers still may require you enter your outgoing mail. address in the Mail Parameter of your OC Mail form.
throw new \Exception('Errort: '. substr($reply, 0, 3) .' DATA not accepted from server!');
Gives me this:
‘Errort: DATA not accepted from server!’
I filled mail parameters with email address, outgoing mail name and with -f parameter infront. None of them affected the output.
Like I say its working for the rest of the mail, really confused as to why just this one it has the issue.
Thanks for all the help so far!
Re: Account — Add an Affiliate (SMTP ERROR)
Post by straightlight » Sat Apr 04, 2020 10:15 pm
must be null as it’s not changing the error message. Why would it return null? Could this be the issue?
Your mail parameter is also empty in the form. Some servers still may require you enter your outgoing mail. address in the Mail Parameter of your OC Mail form.
throw new \Exception('Errort: '. substr($reply, 0, 3) .' DATA not accepted from server!');
Gives me this:
‘Errort: DATA not accepted from server!’
I filled mail parameters with email address, outgoing mail name and with -f parameter infront. None of them affected the output.
Like I say its working for the rest of the mail, really confused as to why just this one it has the issue.
Thanks for all the help so far!
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Re: Account — Add an Affiliate (SMTP ERROR)
Post by scottyboyyy » Sat Apr 04, 2020 10:31 pm
PM sent, thanks for helping me!
I have just done some extra tests.
If I create an account through affiliate/register it makes a new customer and adds affiliate details to `oc_customer_affiliate`.
If I delete its entry in `oc_customer_affiliate`and go to account/affiliate/add I am able to add it back and the mail sends correctly.
It is only for users that registered as a customer that it causes the issue.
So the mail setup I don’t think is the issue.
Re: Account — Add an Affiliate (SMTP ERROR)
Post by letxobnav » Sat Apr 04, 2020 10:34 pm
mail parameter is only used for php mail, not smtp.
throw new \Exception('Error: '.$reply.' DATA not accepted from server!');
to show the entire reply to the period.
could just be a timeout issue.
“Data security is paramount at [. ], and we are committed to protecting the privacy of anyone who is associated with our [. ]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Re: Account — Add an Affiliate (SMTP ERROR)
Post by scottyboyyy » Sat Apr 04, 2020 10:40 pm
mail parameter is only used for php mail, not smtp.
throw new \Exception('Error: '.$reply.' DATA not accepted from server!');
to show the entire reply to the period.
could just be a timeout issue.
Getting nothing for ‘.$reply.’ too.
Is timeout something that I will be able to fix? Or how do I test for that?
Re: Account — Add an Affiliate (SMTP ERROR)
Post by letxobnav » Sat Apr 04, 2020 10:49 pm
are you sure you have the right
DATA not accepted from server line?
“Data security is paramount at [. ], and we are committed to protecting the privacy of anyone who is associated with our [. ]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Re: Account — Add an Affiliate (SMTP ERROR)
Post by scottyboyyy » Sat Apr 04, 2020 10:54 pm
are you sure you have the right
DATA not accepted from server line?
Uncaught exception 'Exception' with message 'Error: DATA nnot accepted from server!' in /system/library/mail/smtp.php:328
I just tried adding it to both the error message. Error remains the same, no additional values as I would expect to see from $reply.
Re: Account — Add an Affiliate (SMTP ERROR)
Post by letxobnav » Sat Apr 04, 2020 11:12 pm
yep, looks like it.
you could try replacing the smtp class with the one from version 3.1.0.0.
It is basically the same but it has a function (handleReply) which promises to handle the replies better from slow mail server responses.
you can set the attempts counter in the class.
Not sure this is your problem but it looks like it.
to)) < $to = implode(',', $this->to); > else < $to = $this->to; > $boundary = '----=_NextPart_' . md5(time()); $header = 'MIME-Version: 1.0' . PHP_EOL; $header .= 'To: ' . PHP_EOL; $header .= 'Subject: =?UTF-8?B?' . base64_encode($this->subject) . '?=' . PHP_EOL; $header .= 'Date: ' . date('D, d M Y H:i:s O') . PHP_EOL; $header .= 'From: =?UTF-8?B?' . base64_encode($this->sender) . '?= from . '>' . PHP_EOL; if (!$this->reply_to) < $header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->sender) . '?= from . '>' . PHP_EOL; > else < $header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->reply_to) . '?= reply_to . '>' . PHP_EOL; > $header .= 'Return-Path: ' . $this->from . PHP_EOL; $header .= 'X-Mailer: PHP/' . phpversion() . PHP_EOL; $header .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . PHP_EOL . PHP_EOL; if (!$this->html) < $message = '--' . $boundary . PHP_EOL; $message .= 'Content-Type: text/plain; charset="utf-8"' . PHP_EOL; $message .= 'Content-Transfer-Encoding: 8bit' . PHP_EOL . PHP_EOL; $message .= $this->text . PHP_EOL; > else < $message = '--' . $boundary . PHP_EOL; $message .= 'Content-Type: multipart/alternative; boundary="' . $boundary . '_alt"' . PHP_EOL . PHP_EOL; $message .= '--' . $boundary . '_alt' . PHP_EOL; $message .= 'Content-Type: text/plain; charset="utf-8"' . PHP_EOL; $message .= 'Content-Transfer-Encoding: 8bit' . PHP_EOL . PHP_EOL; if ($this->text) < $message .= $this->text . PHP_EOL; > else < $message .= 'This is a HTML email and your email client software does not support HTML email!' . PHP_EOL; >$message .= '--' . $boundary . '_alt' . PHP_EOL; $message .= 'Content-Type: text/html; charset="utf-8"' . PHP_EOL; $message .= 'Content-Transfer-Encoding: 8bit' . PHP_EOL . PHP_EOL; $message .= $this->html . PHP_EOL; $message .= '--' . $boundary . '_alt--' . PHP_EOL; > foreach ($this->attachments as $attachment) < if (file_exists($attachment)) < $handle = fopen($attachment, 'r'); $content = fread($handle, filesize($attachment)); fclose($handle); $message .= '--' . $boundary . PHP_EOL; $message .= 'Content-Type: application/octet-stream; name="' . basename($attachment) . '"' . PHP_EOL; $message .= 'Content-Transfer-Encoding: base64' . PHP_EOL; $message .= 'Content-Disposition: attachment; filename="' . basename($attachment) . '"' . PHP_EOL; $message .= 'Content-ID: ' . PHP_EOL; $message .= 'X-Attachment-Id: ' . urlencode(basename($attachment)) . PHP_EOL . PHP_EOL; $message .= chunk_split(base64_encode($content)); > > $message .= '--' . $boundary . '--' . PHP_EOL; if (substr($this->smtp_hostname, 0, 3) == 'tls') < $hostname = substr($this->smtp_hostname, 6); > else < $hostname = $this->smtp_hostname; > $handle = fsockopen($hostname, $this->smtp_port, $errno, $errstr, $this->smtp_timeout); if (!$handle) < throw new \Exception('Error: ' . $errstr . ' (' . $errno . ')'); >else < if (substr(PHP_OS, 0, 3) != 'WIN') < socket_set_timeout($handle, $this->smtp_timeout, 0); > while ($line = fgets($handle, 515)) < if (substr($line, 3, 1) == ' ') < break; >> fputs($handle, 'EHLO ' . getenv('SERVER_NAME') . "\r\n"); $reply = ''; while ($line = fgets($handle, 515)) < $reply .= $line; //some SMTP servers respond with 220 code before responding with 250. hence, we need to ignore 220 response string if (substr($reply, 0, 3) == 220 && substr($line, 3, 1) == ' ') < $reply = ''; continue; >else if (substr($line, 3, 1) == ' ') < break; >> if (substr($reply, 0, 3) != 250) < throw new \Exception('Error: EHLO not accepted from server!'); >if (substr($this->smtp_hostname, 0, 3) == 'tls') < fputs($handle, 'STARTTLS' . "\r\n"); $this->handleReply($handle, 220, 'Error: STARTTLS not accepted from server!'); stream_socket_enable_crypto($handle, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); > if (!empty($this->smtp_username) && !empty($this->smtp_password)) < fputs($handle, 'EHLO ' . getenv('SERVER_NAME') . "\r\n"); $this->handleReply($handle, 250, 'Error: EHLO not accepted from server!'); fputs($handle, 'AUTH LOGIN' . "\r\n"); $this->handleReply($handle, 334, 'Error: AUTH LOGIN not accepted from server!'); fputs($handle, base64_encode($this->smtp_username) . "\r\n"); $this->handleReply($handle, 334, 'Error: Username not accepted from server!'); fputs($handle, base64_encode($this->smtp_password) . "\r\n"); $this->handleReply($handle, 235, 'Error: Password not accepted from server!'); > else < fputs($handle, 'HELO ' . getenv('SERVER_NAME') . "\r\n"); $this->handleReply($handle, 250, 'Error: HELO not accepted from server!'); > if ($this->verp) < fputs($handle, 'MAIL FROM: from . '>XVERP' . "\r\n"); > else < fputs($handle, 'MAIL FROM: from . '>' . "\r\n"); > $this->handleReply($handle, 250, 'Error: MAIL FROM not accepted from server!'); if (!is_array($this->to)) < fputs($handle, 'RCPT TO: to . '>' . "\r\n"); $reply = $this->handleReply($handle, false, 'RCPT TO [!array]'); if ((substr($reply, 0, 3) != 250) && (substr($reply, 0, 3) != 251)) < throw new \Exception('Error: RCPT TO not accepted from server!'); >> else < foreach ($this->to as $recipient) < fputs($handle, 'RCPT TO: ' . "\r\n"); $reply = $this->handleReply($handle, false, 'RCPT TO [array]'); if ((substr($reply, 0, 3) != 250) && (substr($reply, 0, 3) != 251)) < throw new \Exception('Error: RCPT TO not accepted from server!'); >> > fputs($handle, 'DATA' . "\r\n"); $this->handleReply($handle, 354, 'Error: DATA not accepted from server!'); // According to rfc 821 we should not send more than 1000 including the CRLF $message = str_replace("\r\n", "\n", $header . $message); $message = str_replace("\r", "\n", $message); $lines = explode("\n", $message); foreach ($lines as $line) < $results = str_split($line, 998); foreach ($results as $result) < if (substr(PHP_OS, 0, 3) != 'WIN') < fputs($handle, $result . "\r\n"); >else < fputs($handle, str_replace("\n", "\r\n", $result) . "\r\n"); >> > fputs($handle, '.' . "\r\n"); $this->handleReply($handle, 250, 'Error: DATA not accepted from server!'); fputs($handle, 'QUIT' . "\r\n"); $this->handleReply($handle, 221, 'Error: QUIT not accepted from server!'); fclose($handle); > > private function handleReply($handle, $status_code = false, $error_text = false, $counter = 0) < $reply = ''; while (($line = fgets($handle, 515)) !== false) < $reply .= $line; if (substr($line, 3, 1) == ' ') < break; >> // Handle slowish server responses (generally due to policy servers) if (!$line && empty($reply) && $counter < $this->max_attempts) < sleep(1); $counter++; return $this->handleReply($handle, $status_code, $error_text, $counter); > if ($status_code) < if (substr($reply, 0, 3) != $status_code) < throw new \Exception($error_text); >> return $reply; > >
“Data security is paramount at [. ], and we are committed to protecting the privacy of anyone who is associated with our [. ]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.