Page 1 of 1

Unexpected token < in JSON at position 0, failed to connect mail server?? help!!

Posted: Thu Oct 26, 2017 6:36 am
by alex067
I have been removing the "your address" and telephone field from checkout/registration so my store only requires the email and password

however i think i changed something in one of the files and now i get this error everytime i register a new user through checkout/register:

"unexpected token < in JSON at position 0
OK
Warning: mail(); failed to connect to mail server etc.etc. etc. "

i dont know why the mail() error is showing up, because i didnt even touch the system/librayr/mail/mail.php...

does anyone know how to fix this? the two files i changed are checkout/register.twig and checkout/register.php, where i removed the address and telephone fields


here is a screenshot of the error message: https://ibb.co/khvzBR

Re: Unexpected token < in JSON at position 0, failed to connect mail server?? help!!

Posted: Thu Oct 26, 2017 8:07 am
by alex067
forgot to mention:


the error happens when I register, so I fill in:

first name, last name, email, password & confirm password, check box privacy, click "register" and then the error pops up. but the user is succesfully registered, if i refresh the page, it will have created my account

Re: Unexpected token < in JSON at position 0, failed to connect mail server?? help!!

Posted: Thu Oct 26, 2017 8:38 am
by straightlight
Ensure to configure the admin - > system - > settings - > edit page - > mail tab form before officially starting to use the emails. Most merchants do configure their email options with Gmail.

Re: Unexpected token < in JSON at position 0, failed to connect mail server?? help!!

Posted: Thu Oct 26, 2017 9:09 am
by alex067
We dont use the emails though! Haven;t touched that code at all

Re: Unexpected token < in JSON at position 0, failed to connect mail server?? help!!

Posted: Sat Nov 04, 2017 2:48 am
by Dhaupin
Just a hunch here, but If you don't use SMTP mail, it could be an autofill issue. Basically it seems like OC is saying its trying to use SMTP, but its not working.

First place to look is admin settings > mail tab, make sure there is nothing filled in the SMTP fields. Additionally, make sure the dropdown is set to "mail" and not SMTP. Make sure it doesnt get autofilled.

Chrome and other browsers often try to fill in autosaved login credentials to fields that arent necessarily a login field. I have had this happen to me many times with SMTP. All it takes is a click on a mail tab/section, even if you close it again. This is a true annoyance for many ecommerce/crm platforms :D