Jump to content

[SOLVED] P.S 1.6 Contact form gets a 500 server error


Recommended Posts

Prestashop 1.6.0.6 / hosted in bluehost

I'm having an issue with the contact form, the form says the email is sent but im not getting anything.
First i tried this solution:

You would edit the ContactController in /controllers/front/
 
Locate the following code

if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]',
    $var_list, $contact->email, $contact->name, $from, ($customer->id ? $customer->firstname.' '.$customer->lastname : ''),
            $fileAttachment) ||
        !Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, $contact->email, $contact->name, $fileAttachment))
            $this->errors[] = Tools::displayError('An error occurred while sending the message.');

In that first if statement, you will see the variable $from which is the customers email address.
 
Change $from to null, which will force Prestashop to use the default store email address

if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]',
    $var_list, $contact->email, $contact->name, null, ($customer->id ? $customer->firstname.' '.$customer->lastname : ''),
            $fileAttachment)

 
 
Didn't work, went back to the original controller, and now i get a 500 server error when i try to send the contact form:

 

500 Server Error

Oops, something went wrong.

Try to refresh this page or feel free to contact us if the problem persists.

 
i have other modules that DO are sending me the emails, and i i already tried sending a test email.

 

i appreciate any help! thanks!

 

 

OK! My bad! i had totally forgot to add the extra fields i had on my contact form to the database.

 

Solved then.

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

  • 1 year later...

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...