Contact form not working – server requires SMTP (no PHP mail())

vandredesigner
3 Posts
vandredesigner posted this 28 August 2025
Ask a Question

Hello,

I am building a website with Nicepage for a law office. My hosting provider (Dominios.pt) does not allow the use of the PHP mail() function for sending emails, as it is disabled on the server for security reasons. Instead, they require using SMTP with authentication (e.g., via PHPMailer).

Here is what I already tried:

I created a sendmail.php file with the standard PHP mail() function, uploaded it into my public_html directory.

In Nicepage, I used the Form → Action → URL option.

For the form action, I tested:

/sendmail.php

https://kanzlei-koelln-stotz.de/sendmail.php

I published the website, but when submitting the form I always get the message:
"Unable to send your message. Please fix errors then try again."

Since my hosting confirmed mail() will never work, my question is:

Is there an official or recommended way to configure Nicepage forms to work with SMTP instead of PHP mail()?

Can I integrate PHPMailer directly into the Nicepage form submission process, or must I fully replace the default handler with a custom script?

If SMTP is the only way, does Nicepage provide a guide or sample implementation?

Thank you for your help.

Vote to pay developers attention to this features or issue.
3 Replies
Order By: Standard | Newest
Support Team
Support Team posted this 28 August 2025

Hi,

Please refer to this article: https://nicepage.com/doc/25066/php-script-sample-for-contact-form-submission, and let us know whether the information from this article will help you.
...................................................
Sincerely,
Paul C.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

vandredesigner
3 Posts
vandredesigner posted this 28 August 2025

Message:
Hello,

Thank you for your response and the PHP script examples.

The issue is that the examples you provided use the mail() function, which is blocked on my hosting server (Dominios.pt) for security reasons. Therefore, these scripts cannot work on my server.

To make the contact form functional, I already adapted Example 1 by replacing the mail() function with PHPMailer using authenticated SMTP. However, the form still does not work—Nicepage continues showing the “Unable to send your message” error.

This approach would ensure two things:

Nicepage receives the expected JSON response (success: true) and stops showing the error.

Dominios.pt will accept the email, because it is sent via authenticated SMTP.

Could you please advise if there is an official way to integrate PHPMailer/SMTP into the Nicepage contact form, or do I need to always replace the default form handler with a custom PHP script?

Thank you very much for your guidance.

Support Team
Support Team posted this 28 August 2025

Hi,

Unfortunately, there is no official way to integrate SMTP into our contact forms, as our form script uses the PHP mail function. Therefore, we suggest using a custom PHP script to make your contact forms work. Will it be helpful?
...................................................
Sincerely,
Paul C.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

You must log in or register to leave comments