Mobile app version of vmapp.org
Login or Join
Reiling115

: After uploading sendmail.php to the webserver, what is its URL? How do I correctly write out a path to a sendmail.php that is in the parent directly after it's uploaded to the hosting server?

@Reiling115

Posted in: #Php #Url

How do I correctly write out a path to a sendmail.php that is in the parent directly after it's uploaded to the hosting server?

Is it www.example.com or www.example.com/sendmail.php
Or, is it a good idea to have the sendmail.php in its own directory such as www.example.com/script/sendmail.php
In addition, must the webmaster allow server rights to see this PHP in order to have it work? How does the webmaster know if those right are allocated....

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Reiling115

1 Comments

Sorted by latest first Latest Oldest Best

 

@Murray155

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 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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme