Page 2 of 2

Posted: Mon Aug 21, 2006 9:28 pm
by aerodromoi
EddyStone wrote:Thanks All. Looks like I have some studying to do!

Oran this is the full Sendmail.php code. If any one can suggest changes to help combat spam. The code would be very much appreciated.

Code: Select all

<?
$Name = $_POST['Name'];
$PhoneNumber = $_POST['PhoneNumber'];
$EMail = $_POST['EMail'];
$Day = $_POST['Day'];
$Month = $_POST['Month'];
$Year = $_POST['Year'];
$Info = $_POST['Info'];
$Comments = $_POST['Comments'];
$msg .= "Name    $Name\n";
$msg .= "PhoneNumber    $PhoneNumber\n";
$msg .= "EMail    $EMail\n";
$msg .= "Day    $Day\n";
$msg .= "Month    $Month\n";
$msg .= "Year    $Year\n";
$msg .= "Info    $Info\n";
$msg .= "Comments    $Comments\n";
$to = "emailaddress@rubbish.com";
$subject = "Website Feedback";
$mailheaders = "MIME-Version: 1.0\r\n";
$mailheaders.="To: ".$to."\n"; 
$mailheaders .= "From: ".$name."\n\n";

mail($to, $subject, $msg, $mailheaders);
?>
Just as an idea - you might want to check whether $Name contains any undesired input before inserting it into the mail header.

Code: Select all

$mailheaders . = ereg('(cc\:|bcc\:|to\:)', strtolower($Name)) ? "X-Mailer: PHP " . phpversion() : "From: " . $Name;