1. Home
  2. Site Builder
  3. How to Fix the “Mail() function returned false” Error

How to Fix the “Mail() function returned false” Error

Introduction

This article aims to help you with the “Mail() function returned false” error, which can appear on the contact page of your site created with the tool.

Note :The Glossary contains explanations on multiple topics and can be consulted to clarify certain terms.

Prerequisite

Enter the following address in your web browser : https://mg.n0c.com/en.

Open the interface (how).

Note : Make sure the tool is configured in English (how).

Fixing the “Mail() function returned false” error

Sometimes the error “Mail() function returned false” is displayed at the bottom of the screen.

If this happens, please follow the instructions below:

  1. In the side bar menu, select Settings -> Contact Form.
  2. Enter an email account with the same domain as your hosting in the To and From fields (you will be able to redirect your messages to another address in your N0C panel) and click on the green Publish button to publish the changes:
  1. Once the changes are published, go to the file manager via the N0C panel and edit the file named “contact.php” (how).
  2. Enter the following two lines as comments in the code :
//$headers .= "Reply-To: " . (!empty($this->replyto) ? $this->replyto : $this->from) . "" . PHP_EOL;
//$headers .= "Return-Path: " . $this->from . "" . PHP_EOL;
  1. Save the changes.

Note : You will need to do this every time you publish a change with the tool. Therefore, we  suggest that you keep a backup copy of the contact.php file.

Updated on February 12, 2024

Related Articles