Forum Moderators: coopster
My host offers PHP on their Windows server. I found a PHP script to send me email from my site, but it doesn't work because they don't have sendmail. I have no experience with PHP, so I don't know what to change so that I can send an email. Can anyone tell me where to begin?
Here's a little bit of the script:
<?php
$mail_path = "/usr/sbin/sendmail -i -t";
$mail_to = "info@example.com";
...
ini_set("sendmail_path", $mail_path);
if ($_POST)
{
if($_POST['userEmail'])
{
if( mail($mail_to,$mail_subject,"\t From: ".$_POST['userName']."\n \t Email: ".$_POST['userEmail']. "\n\n\n\n".stripslashes($_POST['userMessage']),"From: $_POST[userEmail]\r\n"."Reply-To: $_POST[userEmail]\r\n") )
{
$html = '<p>Thank you We will respond to your message shortly.</p>';
}
}
}?> tia,
g.
I don't think sendmail is available for windows (although I could be wrong) which would mean that the script you have would only work on a Unix platform with sendmail installed.
PHP's mail function: [php.net...]
wruk999
The easiest way to fix your problem is to use ini_set to change the SMTP values to that of a unix host running sendmail, you can then send mail via this box providing you have authorisation.