Post by suraj_sella » Mon Jan 22, 2018 6:03 pm

I am receiving the following error when registered users place an order.

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<br />
<b>Fatal error</b>: Uncaught exception 'Exception' with message 'Error: DATA not accepted from server!' in /home/xxx/public_html/system/library/mail/smtp.php:328
Stack trace:
#0 /home/xxx/public_html/system/library/mail.php(142): Mail\Smtp-&gt;send()
#1 /home/xxx/public_html/catalog/controller/mail/order.php(275): Mail-&gt;send()
#2 /home/xxx/public_html/catalog/controller/mail/order.php(34): ControllerMailOrder-&gt;add(Array, '1', '', '')
#3 [internal function]: ControllerMailOrder-&gt;index('checkout/order/...', Array)
#4 /home/xxx/storage/modification/system/engine/action.php(79): call_user_func_array(Array, Array)
#5 /home/xxx/public_html/system/engine/event.php(62): Action-&gt;execute(Object(Registry), Array)
#6 /home/xxx/storage/modification/system/engine/loader.php(232): Event-&gt;trigger('model/checkout/...', Array)
#7 [internal function]: Loader-&gt;{closure}(Array, Array)
#8 /home/xxx/public_html/system/engine/proxy.php(47): call_user_func_array(Object(Closure), Array)
#9 /home/xxx/public_html/c in <b>/home/xxx/public_html/system/library/mail/smtp.php</b> on line <b>328</b><br />


The code in library/mail/smtp.php is

Code: Select all

fputs($handle, 'DATA' . "\r\n");
OC version 3.0.2.0

Please note that it was previously working fine, also the guest checkout option goes through and mail is received. Mail is also received for the registration of users,etc.

Please help. Thank you.

User avatar
New member

Posts

Joined
Wed Nov 22, 2017 3:57 pm

Post by straightlight » Wed Jan 24, 2018 4:51 am

The best solution in this case would be to download an extension from the marketplace that will either use or remove the base64 encoding while sending those emails.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by suraj_sella » Wed Jan 24, 2018 1:41 pm

straightlight wrote:
Wed Jan 24, 2018 4:51 am
The best solution in this case would be to download an extension from the marketplace that will either use or remove the base64 encoding while sending those emails.
Thank you sir, but i would prefer to learn to remove the encoding myself and implement the changes to make it work. Thanks for your valuable time! :)

User avatar
New member

Posts

Joined
Wed Nov 22, 2017 3:57 pm

Post by ADD Creative » Wed Jan 24, 2018 7:47 pm

You could try outputting more information with the error, which may help track down the problem.

Temporary change line 294 in system/library/mail/smtp.php from.

Code: Select all

throw new \Exception('Error: DATA not accepted from server!');
To.

Code: Select all

throw new \Exception('Error: DATA not accepted from server! ' . $reply);
Then test again and see what error you are getting.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by suraj_sella » Thu Jan 25, 2018 2:04 pm

ADD Creative wrote:
Wed Jan 24, 2018 7:47 pm
You could try outputting more information with the error, which may help track down the problem.

Temporary change line 294 in system/library/mail/smtp.php from.

Code: Select all

throw new \Exception('Error: DATA not accepted from server!');
To.

Code: Select all

throw new \Exception('Error: DATA not accepted from server! ' . $reply);
Then test again and see what error you are getting.
I did what you say but same error nothing new/added to it.
My error is coming from line 328, you mean 328 instead of 294 right?
When i added that reply, i got this information

" Error: DATA not accepted from server!550 This message was classified as SPAM and may not be delivered.
"
Rings a bell? Btw, thanks for showering such sunlight on this issue!

EDIT : After a little research i understand that my outgoing mail is being blocked from leaving the server due to it's marking of spam. How do i fix this? Please help.

BIG UPDATE : I found this being returned to my default mail account :
A message that you sent was rejected by the local scanning code that
checks incoming messages on this system. The following error was given:

This message was classified as SPAM and may not be delivered.

------ This is a copy of your message, including all the headers. ------

Received: from xyz by cp-50.webhostbox.net with local (Exim 4.89)
(envelope-from <xyz@cp-50.webhostbox.net>)
id 1eeK9y-001Rqr-1z
for surajselladurai@amayax.net; Wed, 24 Jan 2018 12:28:10 +0000
To: surajselladurai@amayax.net
Subject: =?UTF-8?B?WW91ck1lZEh1YiAtIE9yZGVyIDQ4OQ==?=
X-PHP-Script: www.xxx.com/index.php for 122.169.4.146
X-PHP-Filename: /home/xyz/public_html/index.php REMOTE_ADDR: 122.169.4.146
MIME-Version: 1.0
Date: Wed, 24 Jan 2018 12:28:09 +0000
From: =?UTF-8?B?WW91ck1lZEh1Yg==?= <oc@xxx.com>
Reply-To: =?UTF-8?B?WW91ck1lZEh1Yg==?= <oc@xxx.com>
Return-Path: oc@xxx.com
X-Mailer: PHP/5.4.45
Content-Type: multipart/mixed; boundary="----=_NextPart_38ce231a61e08d567fdb11f9e5e871cd"
Message-Id: <E1eeK9y-001Rqr-1z@cp-50.webhostbox.net>

------=_NextPart_38ce231a61e08d567fdb11f9e5e871cd
Content-Type: multipart/alternative; boundary="----=_NextPart_38ce231a61e08d567fdb11f9e5e871cd_alt"

------=_NextPart_38ce231a61e08d567fdb11f9e5e871cd_alt
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

This is a HTML email and your email client software does not support HTML email!
------=_NextPart_38ce231a61e08d567fdb11f9e5e871cd_alt
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-1 ... strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>xxx - Order 489</title>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;">
<div style="width: 680px;"><a href="https://www.xxx.com/" title="xxx"><img src="https://www.xxx.com/image/catalog/YMH_350x150.png" alt="xxx" style="margin-bottom: 20px; border: none;" /></a>
<p style="margin-top: 0px; margin-bottom: 20px;">Thank you for placing the order with xxx.com. Your order request has been received successfully. We will process your order payment shortly ( within 4-8 hours). We will notify you upon confirmation.</p>
<p style="margin-top: 0px; margin-bottom: 20px;">To view your order click on the link below:</p>
<p style="margin-top: 0px; margin-bottom: 20px;"><a href="https://www.xxx.com/index.php?route=acc ... 489</a></p>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;" colspan="2">Order Details</td>
</tr>
</thead>
<tbody>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><b>Order ID:</b> 489<br />
<b>Date Added:</b> 24/01/2018<br />
<b>Payment Method:</b> Credit Card/Debit Card<br />
<b>Shipping Method:</b> Free Shipping
</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><b>E-mail:</b> xyz@gmail.com<br />
<b>Telephone:</b> 1232131231<br />
<b>IP Address:</b> 122.1.1.1<br />
<b>Order Status:</b> Pending<br /></td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;">Payment Address</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;">Shipping Address</td>
</tr>
</thead>
<tbody>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;">john<br />legen<br />text<br />here<br />text<br />randomtext</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;">text<br />dummy<br />text<br />dummytext<br />loremipsum<br />United Kingdom</td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;">Product</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;">Model</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: right; padding: 7px; color: #222222;">Quantity</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: right; padding: 7px; color: #222222;">Price</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: right; padding: 7px; color: #222222;">Total</td>
</tr>
</thead>
<tbody>

<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;">Product1
</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;">product 42</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;">30</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;">$3.00</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;">$90.00</td>
</tr>
</tbody>

<tfoot>

<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;" colspan="4"><b>Sub-Total:</b></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;">$90.00</td>
</tr>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;" colspan="4"><b>Total:</b></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;">$90.00</td>
</tr>
</tfoot>

</table>
<p style="margin-top: 0px; margin-bottom: 20px;">Please reply to this e-mail if you have any questions or contact our Customer Service ( 1234567891 ) between 8 to 5 MST.</p>
</div>
</body>
</html>

------=_NextPart_38ce231a61e08d567fdb11f9e5e871cd_alt--
------=_NextPart_38ce231a61e08d567fdb11f9e5e871cd--
Any leads guys?
Last edited by suraj_sella on Thu Jan 25, 2018 2:51 pm, edited 3 times in total.

User avatar
New member

Posts

Joined
Wed Nov 22, 2017 3:57 pm

Post by suraj_sella » Thu Jan 25, 2018 2:26 pm

straightlight wrote:
Wed Jan 24, 2018 4:51 am
The best solution in this case would be to download an extension from the marketplace that will either use or remove the base64 encoding while sending those emails.
I simply tried to remove the base64_encode() from smtp.php. I guess it's not that easy a fix because i got username not accepted error late.

User avatar
New member

Posts

Joined
Wed Nov 22, 2017 3:57 pm

Post by ADD Creative » Fri Jan 26, 2018 3:09 am

If mail is still received from a guest checkout as stated in the original post. I would look at the difference between the mail sent from a guest checkout and a registered checkout. Are you using the same test email and addresses?

The only difference I can think of would be in catalog/view/theme/default/template/mail/order_add.twig

Code: Select all

  {% if customer_id %}
  <p style="margin-top: 0px; margin-bottom: 20px;">{{ text_link }}</p>
  <p style="margin-top: 0px; margin-bottom: 20px;"><a href="{{ link }}">{{ link }}</a></p>
  {% endif %}
customer_id would not be set for a guest checkout so try temporarily removing the above code. I could be the account link is causing the mail to be marked as spam.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by suraj_sella » Fri Jan 26, 2018 1:55 pm

ADD Creative wrote:
Fri Jan 26, 2018 3:09 am
If mail is still received from a guest checkout as stated in the original post. I would look at the difference between the mail sent from a guest checkout and a registered checkout. Are you using the same test email and addresses?

The only difference I can think of would be in catalog/view/theme/default/template/mail/order_add.twig

Code: Select all

  {% if customer_id %}
  <p style="margin-top: 0px; margin-bottom: 20px;">{{ text_link }}</p>
  <p style="margin-top: 0px; margin-bottom: 20px;"><a href="{{ link }}">{{ link }}</a></p>
  {% endif %}
customer_id would not be set for a guest checkout so try temporarily removing the above code. I could be the account link is causing the mail to be marked as spam.
Will do! Also, sometimes(1/20 times) this order mail also goes through with the respective order histories replying to the mail thread!
Edit : i tried through different mail addresses too. same result. Also, guest checkout does proceed with the same address.

User avatar
New member

Posts

Joined
Wed Nov 22, 2017 3:57 pm

Post by IP_CAM » Sat Jan 27, 2018 9:38 am

suraj_sella wrote:
Wed Jan 24, 2018 1:41 pm
Thank you sir, but i would prefer to learn to remove the encoding myself and implement the changes to make it work. Thanks for your valuable time! :)
Well, just to give you a hint, the easiest way, to implement Code into Source would be, to download some
free VqMod/OcMod Extensions, related to/with the Matter, because then, you'll not only find out, WHERE
something needs to be changed, added, removed, whatever, but also, WHAT Code will be required, to
make such changes.
Good Luck!
Ernie
---
A wild VqMod Example:
IN:

Code: Select all

<file name="catalog/controller/common/header.php">
<operation>
<search position="before"><![CDATA[

Code: Select all

$this->data['text_home'] = $this->language->get('text_home');
]]></search>
<add><![CDATA[

Code: Select all

$this->data['es_status'] = $this->config->get('es_status');
$this->data['es_use_more'] = $this->config->get('es_use_more');
$this->data['es_use_back_to_top'] = $this->config->get('es_use_back_to_top');
$this->data['es_use_sticky_footer'] = $this->config->get('es_use_sticky_footer');
]]></add>
</operation>
</file>
----
And as OcMod:
IN:

Code: Select all

<file path="catalog/controller/common/header.php">
<operation>
<search><![CDATA[

Code: Select all

$this->data['text_home'] = $this->language->get('text_home');
]]></search>
<add position="before"><![CDATA[

Code: Select all

$this->data['es_status'] = $this->config->get('es_status');
$this->data['es_use_more'] = $this->config->get('es_use_more');
$this->data['es_use_back_to_top'] = $this->config->get('es_use_back_to_top');
$this->data['es_use_sticky_footer'] = $this->config->get('es_use_sticky_footer');
]]></add>
</operation>
</file>
---

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by suraj_sella » Sun Jan 28, 2018 12:11 pm

ADD Creative wrote:
Fri Jan 26, 2018 3:09 am
If mail is still received from a guest checkout as stated in the original post. I would look at the difference between the mail sent from a guest checkout and a registered checkout. Are you using the same test email and addresses?

The only difference I can think of would be in catalog/view/theme/default/template/mail/order_add.twig

Code: Select all

  {% if customer_id %}
  <p style="margin-top: 0px; margin-bottom: 20px;">{{ text_link }}</p>
  <p style="margin-top: 0px; margin-bottom: 20px;"><a href="{{ link }}">{{ link }}</a></p>
  {% endif %}
customer_id would not be set for a guest checkout so try temporarily removing the above code. I could be the account link is causing the mail to be marked as spam.
On point once again. Thank you so much! It was indeed the link causing the mail to be marked as spam. I gave the direct user account link of route=account/account . This is also a false positive right?

User avatar
New member

Posts

Joined
Wed Nov 22, 2017 3:57 pm

Post by suraj_sella » Sun Jan 28, 2018 12:19 pm

IP_CAM wrote:
Sat Jan 27, 2018 9:38 am
suraj_sella wrote:
Wed Jan 24, 2018 1:41 pm
Thank you sir, but i would prefer to learn to remove the encoding myself and implement the changes to make it work. Thanks for your valuable time! :)
Well, just to give you a hint, the easiest way, to implement Code into Source would be, to download some
free VqMod/OcMod Extensions, related to/with the Matter, because then, you'll not only find out, WHERE
something needs to be changed, added, removed, whatever, but also, WHAT Code will be required, to
make such changes.
Good Luck!
Ernie
---
A wild VqMod Example:
IN:

Code: Select all

<file name="catalog/controller/common/header.php">
<operation>
<search position="before"><![CDATA[

Code: Select all

$this->data['text_home'] = $this->language->get('text_home');
]]></search>
<add><![CDATA[

Code: Select all

$this->data['es_status'] = $this->config->get('es_status');
$this->data['es_use_more'] = $this->config->get('es_use_more');
$this->data['es_use_back_to_top'] = $this->config->get('es_use_back_to_top');
$this->data['es_use_sticky_footer'] = $this->config->get('es_use_sticky_footer');
]]></add>
</operation>
</file>
----
And as OcMod:
IN:

Code: Select all

<file path="catalog/controller/common/header.php">
<operation>
<search><![CDATA[

Code: Select all

$this->data['text_home'] = $this->language->get('text_home');
]]></search>
<add position="before"><![CDATA[

Code: Select all

$this->data['es_status'] = $this->config->get('es_status');
$this->data['es_use_more'] = $this->config->get('es_use_more');
$this->data['es_use_back_to_top'] = $this->config->get('es_use_back_to_top');
$this->data['es_use_sticky_footer'] = $this->config->get('es_use_sticky_footer');
]]></add>
</operation>
</file>
---
Great! Thanks a lot for your valuable time. This will definitely help if and when i code an extension for opencart.

User avatar
New member

Posts

Joined
Wed Nov 22, 2017 3:57 pm

Post by ADD Creative » Mon Jan 29, 2018 6:11 pm

suraj_sella wrote:
Sun Jan 28, 2018 12:11 pm
On point once again. Thank you so much! It was indeed the link causing the mail to be marked as spam. I gave the direct user account link of route=account/account . This is also a false positive right?
Looks like a false positive. You could try contacting your host about it or check your URL is not in some sort of blacklist.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by suraj_sella » Mon Jan 29, 2018 6:26 pm

ADD Creative wrote:
Mon Jan 29, 2018 6:11 pm
suraj_sella wrote:
Sun Jan 28, 2018 12:11 pm
On point once again. Thank you so much! It was indeed the link causing the mail to be marked as spam. I gave the direct user account link of route=account/account . This is also a false positive right?
Looks like a false positive. You could try contacting your host about it or check your URL is not in some sort of blacklist.
Thanks a lot for your valuable time sir. :)

User avatar
New member

Posts

Joined
Wed Nov 22, 2017 3:57 pm
Who is online

Users browsing this forum: No registered users and 177 guests