It depends on what you're wanting to do, and it depends on your web server. However, in general, if you wanted to access a file named sendmail.php directly, you would simply place it into your document root directory, and then you could visit it at http://www.example.com/sendmail.php
. This assumes that sendmail.php
contains some code which you want the public to be able to execute. The directory name or whether it's in its own directory would really just be a matter of preference. However, if you were intended for that to contain scripts which would simply be included, then it would be best to place it in a directory outside of the document root and then include it inside of your script where you need it.
Yes, the server must have read access at least to the script, and execute access to the containing directories. If it can't read it, it can't execute it, and it would give you an error, usually a file permission error or perhaps the web server would serve a 403 status, etc. Most websites run PHP scripts, and so it should be assumed that a stock web hosting environment should be able to run those scripts out of the box. If there is an error, you may want to talk to your host.
That being said, sending mail can be a dangerous thing. Much of the spam out there doesn't come from email addresses that are intended for spam, but instead come from compromised websites where the spammer finds an unprotected for to send their emails. Most hosts will hold you responsible for any inappropriate email that you send. Therefore, it would be important to make sure that your scripts are well protected, and be especially certain to sanitize the data that you plan to send through your script.