good day,
i have this code in my site and it works perfectly fine. but the problem is, it doesnt check whether the email of the sender is correct. it sends the mail even if the email address of the sender is not in a valid format. it also redirect me to my thanks page. can anyone share his/her knowledge about PHP mail() function. can anyone make the code im using as perfectly as it could. pleasee… helps are much appreciated.
[CODE]<?php
$name=$_POST[‘name’];
$email=$_POST[’email’];
$subject1=$_POST[‘subject’];
$message=$_POST[‘message’];
$ip=$_SERVER[“REMOTE_ADDR”];
$host = gethostbyaddr($_SERVER[‘REMOTE_ADDR’]);
$host = $ip.”.”.$host;
$mon=date(m);
$day=date(j);
$year=date(y);
$hour=date(g);
$min=date(i);
$sec=date(s);
$hour=$hour-2;
if($hour<=0) { $hour+=12; }
$ts = “$hour:$min:$sec on $mon/$day/$year”;
$subject=”[My Subject]:”.” $subject1″;
$body=”
Message from: $name
Subject: $subject1
E-mail: $email
Message: $message
Host: $host
Time: $ts”;
if (mail(’[email protected]’, $subject, $body,”From: {$name} <{$email}>”)):
header(“location:/thanks.html”);
else:
header(“location:/mailerror.html”);
endif;
?>
and also where do i gonna insert the CC and BCC in this code?
can PHP mail() function can hold more than 1 email at the TO? not in CC and BCC