kosaic
03-17-2010, 05:33 PM
Morning,
I have the following code on my site, when a user fills out a form, I post to a page with the following code. Pretty basic I know, however my host has disabled php mail on all it's servers for goodness knows how long.
My question is, How do I re-jig this code to work with SMTP instead ? (sorry, not very handy with PHP myself)
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Please click 'BACK' and Enter a valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Please fill in all the required (<FONT COLOR='RED'>*</FONT>) fields</h2>\n";
die ("Please click 'BACK' on your webbrowser and try again.<BR><CENTER><B>Your message has NOT been sent!</CENTER></B>");
}
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";
mail("my_email@here.com", $subject, $message, $from);
?>
Thanks for any and all help.
Kosaic
I have the following code on my site, when a user fills out a form, I post to a page with the following code. Pretty basic I know, however my host has disabled php mail on all it's servers for goodness knows how long.
My question is, How do I re-jig this code to work with SMTP instead ? (sorry, not very handy with PHP myself)
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Please click 'BACK' and Enter a valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Please fill in all the required (<FONT COLOR='RED'>*</FONT>) fields</h2>\n";
die ("Please click 'BACK' on your webbrowser and try again.<BR><CENTER><B>Your message has NOT been sent!</CENTER></B>");
}
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";
mail("my_email@here.com", $subject, $message, $from);
?>
Thanks for any and all help.
Kosaic