Jump to content

Sending failed using mail() as PHP's default mail() function returned boolean FALSE


Recommended Posts

I get this error: Sending failed using mail() as PHP's default mail() function returned boolean FALSE

First check if PHPs mail function is working outside PrestaShop. Follow the documentation [1] to create a standalone file and upload it to your server to send an email to an address under your control. If it does not work, contact your hosting provider (use of PHP's native mail function may be limited in server settings). Otherwise post again.

 

[1] http://php.net/manual/en/book.mail.php

 

Hope that helps!

 

Marty Shue

Share this post


Link to post
Share on other sites

  • 1 month later...

Hello,

 

I have the same problem.

I test the PHP mail fonction by running this script :

<?php

$Name = "Ukoo Guillaume"; //senders name
$email = "[email protected]"; //senders e-mail adress
$recipient = "[email protected]"; //recipient
$mail_body = "PHP mail() fonctionne !"; //mail body
$subject = "php mail"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields

mail($recipient, $subject, $mail_body, $header); //mail command 

 

I receive this email, but not the mails send from PrestaShop...

What's the next step to test ?

 

Regards

Edited by Ukoo - Guillaume (see edit history)

Share this post


Link to post
Share on other sites

  • 1 month later...

I'm referring to PS 1.5.3.1. I had the same problems. The fix described above didn't work for me. My server-settings caused problems due to an empty "From"-field (FYI: my shop is hosted with Hosteurope).

 

It can be fixed changing these files:

  • /tools/swift/Swift/Plugin/MailSend.php
  • /tools/swift/Swift/Message.php
  • /tools/swift/Swift.php

 

 

/tools/swift/Swift/Plugin/MailSend.php (around line 158)

 

Old:

$headers = $headers->build();

 

New:

$headers = $headers->build();

$params = "";

 

/tools/swift/Swift/Message.php (around line 79)

 

Old:

$this->setFrom("");

 

New:

$this->setFrom("[email protected]");

 

/tools/swift/Swift.php (around line 370)

 

Old:

if (!($has_reply_to = $message->getReplyTo())) $message->setReplyTo($from);

 

New:

if (!($has_reply_to = $message->getReplyTo())) $message->setReplyTo($from);

if (!$has_reply_to[0]) $message->setReplyTo($from->getAddress());

  • Like 2

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • 3 weeks later...
  • 4 weeks later...
  • 3 weeks later...

Cheers Sale Mechanics! I setup "PS 1.5.3.1" on Cloud Servers Rackspace , and I follow your instruction but it doesn't work . Pls help me.

Thanks

Share this post


Link to post
Share on other sites

  • 2 months later...

SOS prestashop 1.5 no envia los correos intento hacer enviar un correo de prueba y me sale Error: Por favor compruebe su configuración Sending failed using mail() as PHP's default mail() function returned boolean FALSE.

 

por favor ayuden

Share this post


Link to post
Share on other sites

SOS prestashop 1.5 no envia los correos intento hacer enviar un correo de prueba y me sale Error: Por favor compruebe su configuración Sending failed using mail() as PHP's default mail() function returned boolean FALSE.

 

por favor ayuden

 

hello

 

please describe your issue in english, not everyone here is fluent in spanish (we are in english section)

i will be greatefull

 

regards

  • Like 1

Share this post


Link to post
Share on other sites

  • 3 weeks later...

I'm referring to PS 1.5.3.1. I had the same problems. The fix described above didn't work for me. My server-settings caused problems due to an empty "From"-field (FYI: my shop is hosted with Hosteurope).

 

It can be fixed changing these files:

  • /tools/swift/Swift/Plugin/MailSend.php
  • /tools/swift/Swift/Message.php
  • /tools/swift/Swift.php

 

/tools/swift/Swift/Plugin/MailSend.php (around line 158)

 

Old:

$headers = $headers->build();

 

New:

$headers = $headers->build();

$params = "";

 

/tools/swift/Swift/Message.php (around line 79)

 

Old:

$this->setFrom("");

 

New:

$this->setFrom("[email protected]");

 

/tools/swift/Swift.php (around line 370)

 

Old:

if (!($has_reply_to = $message->getReplyTo())) $message->setReplyTo($from);

 

New:

if (!($has_reply_to = $message->getReplyTo())) $message->setReplyTo($from);

if (!$has_reply_to[0]) $message->setReplyTo($from->getAddress());

 

 

 

 

it works ... thank you very much

Share this post


Link to post
Share on other sites

  • 2 months later...
  • 3 months later...

A full day I'm trying to change just like this to describe it. I can't get in my prestashop 1.5.3.1 Please I'm about to finish my website I want to help as per work

 

 

 

Sending failed using mail() as PHP's default mail() function returned boolean FALSE.

  • /tools/swift/Swift/Plugin/MailSend.php
  • /tools/swift/Swift/Message.php
  • /tools/swift/Swift.php


/tools/swift/Swift/Plugin/MailSend.php (around line 158)

Old:
$headers = $headers->build();

New:
$headers = $headers->build();
$params = "";

/tools/swift/Swift/Message.php (around line 79)

Old: 
$this->setFrom("");

New: 
$this->setFrom("[email protected]");

/tools/swift/Swift.php (around line 370)

Old:
if (!($has_reply_to = $message->getReplyTo())) $message->setReplyTo($from);

New: 
if (!($has_reply_to = $message->getReplyTo())) $message->setReplyTo($from);
if (!$has_reply_to[0]) $message->setReplyTo($from->getAddress()); 

Share this post


Link to post
Share on other sites

  • 2 months later...

I have also the same problem described here, and I have tried the solution mentioned by "Sale Mechanics" by it does not work for me :(

 

Does anyone know another solution please?

 

The shop is useless without emails... :(

Share this post


Link to post
Share on other sites

  • 1 month later...

Hi,

Suddenly I am not any longer able to send email through Prestashop 1.5.6.1

 

When I try the test email button in Prestashop I get the error "Error: Please check your configuration

Sending failed using mail() as PHP's default mail() function returned boolean FALSE."

 

I modified the three files as suggested in this post, but it does not work.

Any suggestion?

Regards,

Simone

Share this post


Link to post
Share on other sites

  • 4 weeks later...

Hi,

Suddenly I am not any longer able to send email through Prestashop 1.5.6.1

 

When I try the test email button in Prestashop I get the error "Error: Please check your configuration

Sending failed using mail() as PHP's default mail() function returned boolean FALSE."

 

I modified the three files as suggested in this post, but it does not work.

Any suggestion?

Regards,

Simone

 

Look into ps_configuration table for duplicate entries of PS_SHOP_EMAIL and PS_SHOP_NAME. Remove duplicates and you should be OK.

Share this post


Link to post
Share on other sites

Hi,

Suddenly I am not any longer able to send email through Prestashop 1.5.6.1

 

When I try the test email button in Prestashop I get the error "Error: Please check your configuration

Sending failed using mail() as PHP's default mail() function returned boolean FALSE."

 

I modified the three files as suggested in this post, but it does not work.

Any suggestion?

Regards,

Simone

 

are you 100% sure that your host allows to use mail() function? 

it looks like not :/

Share this post


Link to post
Share on other sites

are you 100% sure that your host allows to use mail() function? 

it looks like not :/

 

Message 

 

"Error: Please check your configuration

Sending failed using mail() as PHP's default mail() function returned boolean FALSE."

 

doesn't mean mail() cannot be used because it already returned result (it means it works but has issue).

I found that this issue comes from duplicate entries in ps_configuration of PS_SHOP_EMAIL. Probably the first (and bad) entry contains something like [email protected] and the second one your valid shop email. Another thing is to configure emails in Customers > Contacts (default values are also like [email protected]).

 

If you correct these issues, you don't have to fiddle in the scripts as suggested in above posts.

Edited by iknowsomethingcom (see edit history)

Share this post


Link to post
Share on other sites

Hi iknowsomething,

Thank you for your advice. Actually, after my post, the next day the mail() function worked normally.

I'll follow your suggestion if the problem occurs again.

thanks,

Share this post


Link to post
Share on other sites

  • 1 month later...

Sale Mechanics Thanks it works.... using 1.5.

 

A full day I'm trying to change just like this to describe it. I can't get in my prestashop 1.5.3.1 Please I'm about to finish my website I want to help as per work

 

 

 

Sending failed using mail() as PHP's default mail() function returned boolean FALSE.

  • /tools/swift/Swift/Plugin/MailSend.php
  • /tools/swift/Swift/Message.php
  • /tools/swift/Swift.php

/tools/swift/Swift/Plugin/MailSend.php (around line 158)

 

Old:

$headers = $headers->build();

 

New:

$headers = $headers->build();

$params = "";

 

/tools/swift/Swift/Message.php (around line 79)

 

Old: 

$this->setFrom("");

 

New: 

$this->setFrom("[email protected]");

 

/tools/swift/Swift.php (around line 370)

 

Old:

if (!($has_reply_to = $message->getReplyTo())) $message->setReplyTo($from);

 

New: 

if (!($has_reply_to = $message->getReplyTo())) $message->setReplyTo($from);

if (!$has_reply_to[0]) $message->setReplyTo($from->getAddress()); 

 

Thanks a lot...it worked for me..

  • Like 1

Share this post


Link to post
Share on other sites

  • 1 month later...

Message 

 

"Error: Please check your configuration

Sending failed using mail() as PHP's default mail() function returned boolean FALSE."

 

doesn't mean mail() cannot be used because it already returned result (it means it works but has issue).

I found that this issue comes from duplicate entries in ps_configuration of PS_SHOP_EMAIL. Probably the first (and bad) entry contains something like [email protected] and the second one your valid shop email. Another thing is to configure emails in Customers > Contacts (default values are also like [email protected]).

 

If you correct these issues, you don't have to fiddle in the scripts as suggested in above posts.

Hi iknowsomethingcom,

 

As I am also having issues with email sending, did tried to set SMTP and stuff like that, but none of it will work. Also when placing order or editing orders state in BO I get error: Error: Wrong email template.

 

I was just reading your post and checked my pr_configuration for duplicate entries and I saw following, but I havent find any duplicate pr_shop_email entries:

 

9Rh3oLL.png

 

My emails are currently set to PHP mail() function in BO, so I belive these settings shouldnt be there.

 

Any help is very apreciated, since no one is answering in my topic here.

 

Regards,

 

Vedran

Share this post


Link to post
Share on other sites

check orders > statuses

what kind of mail status your payment / order process use

then verify if template file for this status exists

Hi Milos,

 

Tnx for your reply,

 

I will check as soon as I have access to my PC. I am using cashondelivery and bankwire payment modules.

 

Regards,

 

Vedran

Share this post


Link to post
Share on other sites

Hi Milos,

I just check Orders>Statuses and templates were missing for my statuses.

I did select templates, and after making order it does not reporting Error: Wrong email template but still no mails from shop, neither to my "customer account" email, or for the email adresses setup in Mail Alert module.

Regards,

Vedran

Share this post


Link to post
Share on other sites

  • 5 months later...

also i have the same issue

i try the changes that posted previously but didnt worked for me

my version is 1.6.0.13

 

update

i solve the problem by changing the php version from 5.4 to 5.5 from cpanel

also for the history, i roll back the changes that i made by reading previously posts and still working

Edited by nikos93 (see edit history)

Share this post


Link to post
Share on other sites

Hey guys,

 

I´ve sended 300 newsletter-mails over the Newsletter Pro Modul and now it shows:

 

Sending failed using mail() as PHP's default mail() function returned boolean FALSE.

 

What can I do to send more than 300 mails?

 

Edit:

 

I´ve made the changes but it´s the same. I think the problem is the server. I can only send 300 mails every 30 or 60 minutes.

Edited by Shad86 (see edit history)

Share this post


Link to post
Share on other sites

  • 2 months later...
  • 2 months later...
  • 3 months later...

If you've tried mechanics solution and its not worked for you then you need to enable sendmail in your domains php.ini . If its not enabled in your php.ini file then prestashop wont be able to send using sendmail.

 

I'd tried all the solutions mentioned here and was still unable to use sendmail.  My server provider support eukhost edited the php.ini file in my domians root  and it started working !

 

you may also need to restart exim service on your server if you're on a linux server

Edited by hookahshop (see edit history)

Share this post


Link to post
Share on other sites

  • 3 months later...

Hi,

 

I've tried all solutions listed above, I still get the same message in the log:

Swift Error: Sending failed using mail() as PHP\'s default mail() function returned boolean FALSE.

 

I also find the following message in the log whenever I'm placing an order, maybe there's a link? :

Frontcontroller::init - Cart cannot be loaded or an order has already been placed using this cart

 

I'm on prestashop 1.6.1.3.

 

Thanks!

Share this post


Link to post
Share on other sites

  • 9 months later...
  • 3 years 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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More