Infelicitous
08-06-2010, 08:46 AM
Hi,
I'm trying to set up a page that emails the contents of a form to a specified email address. I had this working fine on a Linux server but the site has now been transferred to a server running Windows Server 2003 (don't ask why, it just has!! :rolleyes:), and now the script to send the mail doesn't work anymore. Here is my script:
<?ob_start();?>
<?php
ini_set("SMTP","mydomain.co.uk");
ini_set("smtp_port","25");
ini_set("sendmail_from","email@mydomain.co.uk");
$name = $_POST['name'];
$businessname = $_POST['businessname'];
$type = $_POST['type'];
$tel = $_POST['tel'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = "You have received a message from: ".$name."";
$message = stripcslashes($message);
$emailcontent = "<img src=\"innologo5.png\" style=\"float:right;\"/><font face=\"verdana, arial, sans serif\">
<h3>You have received a message from:</h3><p />
<b>Name:</b> ".$name."<p />
<b>".$name." is enquiring as a:</b> ".$type."<p />";
if (isset($_POST['businessname'])){
$emailcontent .="<b>".$name."'s company:</b> ".$businessname."<p />";
}
$emailcontent .="<b>".$name."'s contact number:</b> ".$tel."<p />
<b>".$name."'s email address:</b> ".$email."<p />
<b>".$name."'s message:</b><p />
".$message."</font>";
$from = "From: My name\r\n";
$from .= "Reply-To: ".$email."\r\n";
$from .= 'MIME-Version: 1.0' . "\r\n";
$from .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$address = "email@domain.co.uk";
mail($address, $subject, $emailcontent, $from);
if (!mail($address, $subject, $emailcontent, $from)) {
echo "problem";
exit;
}
exit;
?>
<?ob_flush();?>
There's nothing wrong with the POST data from the form because if I just echo the $_POST variables they work fine :), so I know for sure that it's the mail() function that is the problem. Please help!!
I'm trying to set up a page that emails the contents of a form to a specified email address. I had this working fine on a Linux server but the site has now been transferred to a server running Windows Server 2003 (don't ask why, it just has!! :rolleyes:), and now the script to send the mail doesn't work anymore. Here is my script:
<?ob_start();?>
<?php
ini_set("SMTP","mydomain.co.uk");
ini_set("smtp_port","25");
ini_set("sendmail_from","email@mydomain.co.uk");
$name = $_POST['name'];
$businessname = $_POST['businessname'];
$type = $_POST['type'];
$tel = $_POST['tel'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = "You have received a message from: ".$name."";
$message = stripcslashes($message);
$emailcontent = "<img src=\"innologo5.png\" style=\"float:right;\"/><font face=\"verdana, arial, sans serif\">
<h3>You have received a message from:</h3><p />
<b>Name:</b> ".$name."<p />
<b>".$name." is enquiring as a:</b> ".$type."<p />";
if (isset($_POST['businessname'])){
$emailcontent .="<b>".$name."'s company:</b> ".$businessname."<p />";
}
$emailcontent .="<b>".$name."'s contact number:</b> ".$tel."<p />
<b>".$name."'s email address:</b> ".$email."<p />
<b>".$name."'s message:</b><p />
".$message."</font>";
$from = "From: My name\r\n";
$from .= "Reply-To: ".$email."\r\n";
$from .= 'MIME-Version: 1.0' . "\r\n";
$from .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$address = "email@domain.co.uk";
mail($address, $subject, $emailcontent, $from);
if (!mail($address, $subject, $emailcontent, $from)) {
echo "problem";
exit;
}
exit;
?>
<?ob_flush();?>
There's nothing wrong with the POST data from the form because if I just echo the $_POST variables they work fine :), so I know for sure that it's the mail() function that is the problem. Please help!!
