In some case it might be needed to include or run a remote file and display the output on the current site. For this to work the below settings needs to be enabled.
allow_url_fopen = On
allow_url_include = On
But in case those two settings cannot be changed or even after changing it doesn’t work (which happened for me) there is another way. See the main part.
var yname = document.getElementById("yname").value;
var email = document.getElementById("email").value;
var subject = document.getElementById("subject").value;
var mesg = document.getElementById("mesg").value;
/****************** MAIN PART *******************/
var url = "http://www.remote-server.com/mails.php?yname=" + yname + "&email=" + email + "&subject=" + subject + "&mesg=" + mesg;
mailer = document.createElement("script");
mailer.setAttribute('type', 'text/javascript');
mailer.setAttribute('src', url);
mailer.setAttribute('id', 'script_id');
document.getElementById("mailer_holder").appendChild(mailer);
/****************** End of MAIN PART *******************/
alert("Mail Sent Successfully");
document.getElementById("yname").value = "";
document.getElementById("email").value = "";
document.getElementById("subject").value = "";
document.getElementById("mesg").value = "";