How to protect PHP mail from using by another server/user?

Hi,
I need to host my website on my own server, so I’ve to use my own PHP script to send forms from my website.

Everything works fine, but the problem is, that theoretically every other website could use the php script on my server to send emails/forms through it.

Is there a way to protect the script? Or maybe could the script itself checks, if it was called from within the same domain or something like that?

Thank you :slight_smile:

No one can help with this problem?

Maybe you should be looking at a script that has been around for a while.
PHPMailer/PHPMailer: The classic email sending library for PHP (github.com)