ZORANVEDEK Posted November 26, 2020 Share Posted November 26, 2020 (edited) I didn't want to start another thread, but I haven't gotten a response on the previous on, and it appears to be dead. So I'm starting one here. This seems to be an ongoing problem, does any one have a solution? I have been with 3 different Godaddy tech people that all say their site mail is working fine, and it is, but the Prestashop contact form will not send mail from their site. I have been trying to get this hammered out since Monday and have made absolutely no headway. I know someone out there has got to know how to get this working. I have tried setting it up in multiple ways, SMTP, PHP, localhost, relay-hosting.secureserver.net... ....nothing works. There is something in the contact form from Prestashop that is throwing out an error. I went through and labeled every place that error appears in contacform.php, and the error that comes up is on line 489 of contactform.php: } elseif ($url !== '' || empty($serverToken) || $clientToken !== $serverToken || $clientTokenTTL < time() ) { $this->context->controller->errors[] = $this->trans( 'An error 1 occurred while sending the message, please try again.', [], 'Modules.Contactform.Shop' ); $this->createNewToken(); } The #1 is my addition, there are 4 places that throw out that specific error(6 actually but the other two deal with attachments), they are labeled 1-4, that's the one that comes up. If someone could just point me in the right direction to find the help I need, that would be great, telling me what code I need to alter would also be great. I am at a loss as to how to resolve this. Edited November 26, 2020 by ZORANVEDEK Spelling (see edit history) Link to comment Share on other sites More sharing options...
ClassyDevs Posted November 26, 2020 Share Posted November 26, 2020 @ZORANVEDEK First of all which PrestaShop version you are talking about it is related to PrestaShop 1.6.x or 1.7.x Secondly, It will better if you upload in your same site a php normal email script and then try to send email with that. If the email work with regular php script then, their may be any problem in the PrestaShop. If the email didn't send via normal php script then problem in hosting. As a developer we didn't suggest any one to use godaddy server. They not not good enough. Looking forward from you to help you Thank you Link to comment Share on other sites More sharing options...
ZORANVEDEK Posted November 26, 2020 Author Share Posted November 26, 2020 1.7.6.9 A normal script will send, at least the one I got from a tech at Godaddy will send. The Prestashop script will not. ....and I am learning very quickly that Godaddy was not the best option, but that wasn't my decision, and I am stuck with it. Link to comment Share on other sites More sharing options...
ClassyDevs Posted November 26, 2020 Share Posted November 26, 2020 Can you give both of the scripts to me? I will check it out then. Link to comment Share on other sites More sharing options...
ZORANVEDEK Posted November 26, 2020 Author Share Posted November 26, 2020 Mail_test.php works, that came from Godaddy. contactform.php does not, that is stock Prestashop mail_test.php contactform.php Link to comment Share on other sites More sharing options...
ZORANVEDEK Posted November 26, 2020 Author Share Posted November 26, 2020 ...and thank you so much for looking this over. Link to comment Share on other sites More sharing options...
ClassyDevs Posted November 26, 2020 Share Posted November 26, 2020 if ($sendNotificationEmail) { if (empty($contact->email) || !Mail::Send( $this->context->language->id, 'contact', $this->trans('Message from contact form', [], 'Emails.Subject').' [no_sync]', $var_list, $contact->email, $contact->name, null, null, $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $from )) { $this->context->controller->errors[] = $this->trans( 'An error occurred while sending the message.', [], 'Modules.Contactform.Shop' ); } } if ($sendConfirmationEmail) { $var_list['{message}'] = self::MESSAGE_PLACEHOLDER_FOR_OLDER_VERSION; if (!Mail::Send( $this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? $this->trans( 'Your message has been correctly sent #ct%thread_id% #tc%thread_token%', [ '%thread_id%' => $ct->id, '%thread_token%' => $ct->token ], 'Emails.Subject' ) : $this->trans('Your message has been correctly sent', [], 'Emails.Subject')), $var_list, $from, null, null, null, $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $contact->email )) { $this->context->controller->errors[] = $this->trans( 'An error occurred while sending the message.', [], 'Modules.Contactform.Shop' ); } } You can use basic php functions instead of the functions above. I hope that will work. Take a look at this link https://www.w3schools.com/php/func_mail_mail.asp if you need help with php mail function. I would recommend you to contact with the support of that module. I hope they will be able to help you out. Link to comment Share on other sites More sharing options...
ZORANVEDEK Posted November 26, 2020 Author Share Posted November 26, 2020 Thanks for the effort, but replacing the code in contactform.php with that script literally crashes the page(505 error). At this point I'm simply going to scrap the idea of even having a contact form for now, and just drop a static email address on there in text form, I don't like the idea, but it is my only real option at this point. I was hit up a little over a week ago and asked to switch out a pretty basic website for a brick and mortar store with a Prestashop site, and there's simply not enough hours in the day to get this done on the time frame that was given me. If it wasn't a friend asking I wouldn't have taken the job, but it was and I did, so it is what it is. Again, thanks, I appreciate the effort, when I get some more time to focus on this I will come back to it. Link to comment Share on other sites More sharing options...
ClassyDevs Posted November 26, 2020 Share Posted November 26, 2020 If you want our team can help you by investigating the issue. You can contact us via our site or via PM. Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now