View Full Version : php and its mail() function

12-29-2005, 10:08 AM

i have a following problem with the usage of the php's mail() function on one particular server.
the reason of the problem is that the leadership of the server has deactivated this function for "security reasons" and apparently they dont have any other way to send e-mails thru php interface (like SMTP or sendmail) or they just dont even know about it.
there's only one "reasonable" solution in this situation (apart from moving the whole webpage to another server, which is at this moment unacceptable) and that is to move the mailing script on another server and use some php interface to access the script without leaving the server where the webpage itself is run. the thing is that i cant make it done yet, cause i acctually dont have enough information about any specific interface that could be use in this situation. so im asking you, wise guys of the CodingForums, how could this be done? i was thinking of using Curl, but im not sure if this is a good one. if there is any other way to make it work (without substracting the mail script from the rest of the page totally), tell me. im sure there is a solution to this but i personally cant figure it out.

and btw, i couldnt even look at the information from phpinfo() function cause that one is deactivated for security reasons as well.

thank you very much in advance :-) i would be very grateful for any information in this case.


12-29-2005, 10:21 AM
If you can put your mail script in other server with active mail function, you can just redirect information from your server to pass info via post,get or session to your mail function in other server. After sending mail you can agian show result at your server.


12-29-2005, 10:46 PM
if you're going to do that, please make sure you implement some kind of security into the mail script, otherwise you'll create an open relay mail server and that's very bad.

Velox Letum
12-30-2005, 09:49 AM
If you just set it up as a POST receive script, cURL should work just fine in this manner, just make sure to POST a password as well to ensure your 'email solution' doesn't become an open, spammable mail relay as Prikid mentioned. The construction of the script should be pretty easy, it'd be just as if you were receiving a POST form submission, only it'd check for $_POST['r_pass'] too or something similar. That being said, you should make the POST field and the password its self odd and random.

See the php.net page on cURL (http://www.php.net/curl), it has plenty of examples.