Jump to content

Mail won't send Prestashop 1.7


exosian

Recommended Posts

Hello,

Currently, i'm out of options and really don't know how to resolve this matter. I don't even know if this is the right forum to seek guidance and resolve my problem.
The thing is, prestashop won't send emails (through contactform). Test mail works (backend).

But whenever a customer uses the internal contactform, it says: An error occurred while sending your message.

I checked the logs, no logs regarding mail. No errors found. The website prompts only this error: An error occurred while sending your message.
What error? What goes wrong? Why does the STANDARD contactform simply NOT WORK?

For several weeks now I tried every thing on the internets to find a solution but nothing works. I tried every thing in my power and knowledge but this is it.
Prestashop is really a great platform to start a webshop and want to use for all my customers but ONLY this one is bothering me hard time.

I just can't make it work?! 

Do any one can help me out please?

Link: www.exosian.com/contact

Link to comment
Share on other sites

3 hours ago, Prescol said:

Which version are you using? Prestashop has a parameter to enable debug mode. In PS1.6 is within a file called defines.inc.php, inside the config folder. In PS17 it´s in the backend.

Hi Prescol,

Thank you for your comment. I am using PS17.
After setting the debug modes ON i found this error (pop up) after I chose "Customer Service" from the backend.

Warning on line 1046 in file /home/exosian/domains/exosian.com/public_html/controllers/admin/AdminCustomerThreadsController.php
[2] count(): Parameter must be an array or an object that implements Countable

START LINE 1046: if (count($errors) && is_array($errors)) {
            $str_errors = '';
            foreach ($errors as $error) {
                $str_errors .= $error . ', ';
            }
            $str_errors = rtrim(trim($str_errors), ',');
        }

After that, i have send some mails through the contact form.
I uploaded the debug logs.

debug.txt

Link to comment
Share on other sites

After changing this:

if (count($errors) && is_array($errors)) {

to

if (is_array($errors) && count($errors)) {

Not changed anything. I still get this error "Fout opgetreden tijdens het verzenden van uw bericht."
Which means: An error occurred while sending your message.

Edited by exosian (see edit history)
Link to comment
Share on other sites

5 minutes ago, Prescol said:

Nothing more? With debug enabled?

No, nothing :( I can't see strange issues or such. It's just with debugging ON, the error message seems to disappear but still no emails received.
It's just, only the mail doesn't work. All is default. I used PHP settings, my own configuration, nothing works. I always get that there is an error occured while sending the message...

Link to comment
Share on other sites

3 minutes ago, exosian said:

No, nothing :( I can't see strange issues or such. It's just with debugging ON, the error message seems to disappear but still no emails received.
It's just, only the mail doesn't work. All is default. I used PHP settings, my own configuration, nothing works. I always get that there is an error occured while sending the message...

Also, I own another store (brand new) on prestashop 1.7, same issue. Very same issue. E-mails can't be send through contact form due an error.

Link to comment
Share on other sites

Long time ago i had the same , only other prestashop version 

it was at client side server related , so not prestashop ! 
to solve temporary  i used the php mail function so he could use the shop , the forms wil work !
 

and i  had the time to find out where the problems came from , 

perhaps this is for short a tempory solution to use php mail function ,


 

and or it is like already said a php 7.2 issue ,
but i don't have any problems in my own shop ,, with php 7,2 
you can try to switch to at php 7.0 or php 7.1 

 

what are the settings u are using ? are they right ? 

do u use imap or pop ? 

for now you can use PHP Mailfunction so you can go on with your shop

 

Link to comment
Share on other sites

8 hours ago, maconl said:

Long time ago i had the same , only other prestashop version 

it was at client side server related , so not prestashop ! 
to solve temporary  i used the php mail function so he could use the shop , the forms wil work !
 

and i  had the time to find out where the problems came from , 

perhaps this is for short a tempory solution to use php mail function ,


 

and or it is like already said a php 7.2 issue ,
but i don't have any problems in my own shop ,, with php 7,2 
you can try to switch to at php 7.0 or php 7.1 

 

what are the settings u are using ? are they right ? 

do u use imap or pop ? 

for now you can use PHP Mailfunction so you can go on with your shop

 

Hi!

Thank you so much for your comment.

Here are my settings:
PHP: 7.3.15
Webserver: LiteSpeed V7.6
Prestashop 1.7

I already used the PHP function but i'm going to give it another try. If this is not working, i'm going to delete/disable the prestashop's contactform and purchase Contact Form 7 (which always works).

Link to comment
Share on other sites

Just now, exosian said:

Hi!

Thank you so much for your comment.

Here are my settings:
PHP: 7.3.15
Webserver: LiteSpeed V7.6
Prestashop 1.7

I already used the PHP function but i'm going to give it another try. If this is not working, i'm going to delete/disable the prestashop's contactform and purchase Contact Form 7 (which always works).

+ all settings are correct. I am receiving the test e-mail from the back-end.

Link to comment
Share on other sites

And is there an email template for the language selected in the BO?
./themes/nixx/mails/** shop lang/(contact.html and contact.html for registered user) and (contact_form.txt and contact_form.html for host)
** shop lang is an abbreviation of language, eg. nl, en  ....

Edited by Guest (see edit history)
Link to comment
Share on other sites

Hi,

Just wondering if there is a resolution on this? I am having the same issue in 1.7.6.4. Out of the box install, no emails are being sent. Test emails work, just not after a user submits a query via the contact form. Have tried with php versions 5.6 through to 7.3 and no luck.

Thank you

Edited by finchy01 (see edit history)
Link to comment
Share on other sites

Is SMTP set up and not working?
Is sending via PHP mail ?
Do you have php mail enabled on your web host?
Do you have any module eg google recaptcha installed?

Link to comment
Share on other sites

Mail::Send is Prestashop function

mail(... Is PHP mail function

If php function doesn't work, php mail function is not enabled on your web host.
Check that your Prestashop email is correct.
You can insert an echo into the script before include (...

Quote

echo Configuration::get('PS_SHOP_EMAIL');

 

Edited by Guest (see edit history)
Link to comment
Share on other sites

Check if PHP mail function exists:

Quote

<?php

if ( function_exists( 'mail' ) ) { echo 'mail() is available'; } else { echo 'mail() has been disabled'; }

 

Link to comment
Share on other sites

Help for all who do not know if everything is properly set and enabled PHP mail () function on their webhost.

1. Save the attached test-mail.php file to the Prestashop main directory.

Only registered and logged users can download the attachment.

test-mail.php

obrazek.png.89a9cd47217003d05010ab76418e8244.png

2. Paste the address of the eshop and the file path into your browser. e.g:

https://mydomain.com/test-mail.php

obrazek.png.0bb3beba73cecec49b0168e38d17be86.png

3. When everything is OK, you get the information as in the picture:

obrazek.png.125492e41e398e30b2e584249c59d43d.png

4. If there is an error somewhere, you will get an error message.
You'll post this message here, but first read the thread to see if your problem is already resolved by chance.

Edited by Guest (see edit history)
Link to comment
Share on other sites

When I try to get the configuration by adding this to the script (after the include of config.inc.php)

  echo Configuration::get('PS_SHOP_EMAIL');
  if ( function_exists( 'mail' ) ) { echo 'mail() is available'; } else { echo 'mail() has been disabled'; }

I don't get anything printed to screen either or anything in the console.

Link to comment
Share on other sites

If I remove all from the php file except for the following:

include('./config/config.inc.php');
echo Configuration::get('PS_SHOP_EMAIL');
if ( function_exists( 'mail' ) ) { echo 'mail() is available'; } else { echo 'mail() has been disabled'; }

I get the email address configured for the shop correctly displaying and the line 
mail() is available

Link to comment
Share on other sites

  • 2 weeks later...

For my 1.6 store -> Some webhosts have disabled anonymous sending recently so I had to configure my store to use custom SMTP settings and now it works.

For my 1.7 store -> I had to configure custom SMTP settings and also configure the contact form settings (under Module Manager) to "Receive customers' messages by email" (for some reason this option is unchecked by default now).

Thank you for your help.

  • Thanks 3
Link to comment
Share on other sites

Thanks for the feedback.
I suspected that web hosting did not have php mail enabled.
Recently, many e-shops have been attacked by hackers and are sending spam.

Link to comment
Share on other sites

  • 3 months later...
On 5/4/2020 at 11:25 PM, finchy01 said:

For my 1.7 store -> I had to configure custom SMTP settings and also configure the contact form settings (under Module Manager) to "Receive customers' messages by email" (for some reason this option is unchecked by default now).

Thank you! 1 hour wasted debugging and searching to finally discover this damn module with this damn option deactive!!! Why they did this in 1.7??? Who had the brilliant idea to deactive by default the email in the contact form???

Link to comment
Share on other sites

  • 2 weeks later...

After several hours I solved the problem - at least on my site. I have PS 1.7.6.7.

I changed line 421 in /modules/contactform/contactform.php from:

null,

to:

'[email protected]',

It changes the sender address from website address into another one. Of course, instead of '[email protected]' use any valid email for your domain.

It seems like if the website main email is the same as sender address, then the mail will not reach the mailbox, although no error is displayed or logged.

Here is the fixed code within its context:

image.png.fd9af72af4085b858ea590ed889cd247.png

Link to comment
Share on other sites

  • 2 months later...

Okay, I'm  not too  savvy with the PHP,  but I was smart enough to  go through  and label all of the different places that  throw up the phrase "An error occurred while sending the message, please try again"

....and from  there I can locate what  area is likely causing the error,  or at least  at which point it throws up  the warning.  The code in that  area is:

 

        } 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();

That #1 in there is the error that  gets thrown back in both PHP and SMTP mail,  I labeled them  all  1-4,  that  one is on line 489 in modules/contactform.php  in 1.7.6.9. 

I have tried both PHP and SMTP, I can get nothing,  absolutely nothing to send,  not from  the form,  not from  a test email,  nothing. 

However,  the script provided by @Guest,  does send an email,  the form on the site does not.

Again, any  and all  help is appreciated. 

Link to comment
Share on other sites

  • 1 month later...
  • 6 months later...

Hello.

 

I'm fighting this issue also.

 

I've it enabled in contact form and also customer service email set.

 

But everytime I try to send email in adanced parameters -> email I get and error:

 

Error: Please check your configuration

Failed to authenticate on SMTP server with username "[email protected]" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535 5.7.8 Error: authentication failed: authentication failure ". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535 5.7.8 Error: authentication failed: authentication failure ".

 

in var/log/mail.log

Aug  5 01:39:37 server postfix/smtpd[19410]: connect from server. ddomain.com[x.x.x.x]
Aug  5 01:39:40 server postfix/smtpd[19410]: warning: server. ddomain.com[x.x.x.x]: SASL LOGIN authentication failed: authentication failure
Aug  5 01:39:41 server postfix/smtpd[19410]: warning: SASL authentication failure: Password verification failed
Aug  5 01:39:41 server postfix/smtpd[19410]: warning: server. ddomain.com[x.x.x.x]: SASL PLAIN authentication failed: authentication failure
Aug  5 01:39:41 server postfix/smtpd[19410]: lost connection after RSET from server. ddomain.com[x.x.x.x]
Aug  5 01:39:41 server postfix/smtpd[19410]: disconnect from server. ddomain.com[x.x.x.x] ehlo=2 starttls=1 auth=0/2 rset=2 commands=5/7
 

 

I'm sure that username and password is correct.

 

How can I further debug this ?

 

 

 

Link to comment
Share on other sites

Hi!

 

PrestaShop version: 1.7.7.3
 

Server information Linux #157-Ubuntu SMP Fri Jul 9 23:07:57 UTC 2021 x86_64

Server software version: Apache/2.4.29

PHP version: 7.2.24-0ubuntu0.18.04.8

Memory limit: 2048M

Max execution time: 600

Upload Max File size: 128M

 

Thanks

Link to comment
Share on other sites

info_outline Mail configuration
Mail method: You are using your own SMTP parameters.

SMTP server: server.domain.com

SMTP username: Defined

SMTP password: Defined

Encryption: tls

SMTP port: 587

 

I've tried also port 25 without encryption.

Link to comment
Share on other sites

  • 1 year later...

O que pode estar acontecendo na página de configuração de e-mail, é que o seu navegador "impõe" e-mail e senha de seu backoffice.   Para solucionar, exclua este e-mail que está gravado no seu navegador e configure novamente os parâmetros smtp.

Link to comment
Share on other sites

  • 2 months later...
On 5/4/2020 at 11:25 PM, finchy01 said:

....

also configure the contact form settings (under Module Manager) to "Receive customers' messages by email" (for some reason this option is unchecked by default now).

 

Thank you for that. I looked and looked, why the contact form didn't work. This did the trick!!!

Link to comment
Share on other sites

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

In case it helps someone, my problem was the template, look for the file /httpdocs/themes/panda/modules/contactform/views/templates/widget/contactform.tpl, it was missing the hidden parameters at the end, replace that file with the original one It's in modules/contactform...

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...