Kullandığım form sayfası şu. Dosya ismi de mail.php diyelim.

<?php
echo
'
<form name="contactform" id="contactform" action="contact.php" method="POST" >
<table width="500" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr>
    <td width="100"><b>Your Name</b></td>
    <td width="5" class="td"><b>:</b></td>
    <td width="350"><input type=text name="name" size="30" maxlength="30"></td>
  </tr>
  <tr>
	<td width="100"><b>Your Email</b></td>
    <td width="5" class="td"><b>:</b></td>
    <td width="350"><input type=text name="eemail" size="30" maxlength="30"> </td>
  </tr>
  <tr>
    <td width="100"><b>Subject</b></td>
    <td width="5" class="td"><b>:</b></td>
    <td width="350"><input type=text name="subject" size="30" maxlength="30"> </td>
  </tr>
   <tr>
    <td width="100"><b>Your Message</b></td>
    <td width="5" class="td"><b>:</b></td>
    <td width="350" class="td"><textarea name="comments" id="comments" maxlength="1024" style="width:300" rows=10 cols="55" class=inputs></textarea></td>
  </tr>
  <tr>
    <td colspan=2 class="td"> </td>
    <td width="350" class="td"><input type=submit value="   Send   " id="submitbutton" class=inputs> <input type="reset" value="   Clear   " class="inputs"></td>
  </tr>
 </table></form>
';
?>
Doldurulan form contact.php ye gönderiliyor ve oradan mail gönderiliyor. Kod da şu;

<?php
$your_email = "xxxxxx";
$your_smtp = "xxxxx";
$your_smtp_user = "xxxxxx";
$your_smtp_pass = "xxxxxxxx";
$your_website = "xxxxxxxx";


require("mail-smtp/phpmailer/class.phpmailer.php");


//function to check properly formed email address
function isEmailValid($email)
{
  // checks proper syntax
  if( !preg_match( "/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $email))
  {
    return false;
  } 
  
  return true;
  
}


//get contact form details
$name = $_POST['name'];
$email = $_POST['eemail'];
$subject = $_POST['subject'];
$comments = $_POST['comments'];


//validate email address, if it is invalid, then returns error

if (!isEmailValid($email)) {
	die('Invalid Email Address');
}

//start phpmailer code 

$ip = $_SERVER["REMOTE_ADDR"];
$user_agent = $_SERVER['HTTP_USER_AGENT'];



$response="Date: " . date("d F, Y h:i:s A",time()+ 16 * 3600 - 600) ."\n" . "IP Address: $ip\nUser-agent:$user_agent\nEmail: $email\nName: $name\nSubject: $subject\nContents:\n$comments\n";
//mail("info@mypapit.net","Contact form fakapster",$response, $headers);

$mail = new PHPmailer();
$mail->SetLanguage("en", "mail-smtp/phpmailer/language");
$mail->From = $your_email;
$mail->FromName = "Mail";
$mail->Host = $your_smtp;
$mail->Mailer   = "smtp";
$mail->Password = $your_smtp_pass;
$mail->Username = $your_smtp_user;
$mail->CharSet  ="utf-8"; 
$mail->Subject = "Mail Gönderildi";
$mail->SMTPAuth  =  "true";

$mail->Body = $response;
$mail->AddAddress($your_email,"$your_website Admin");
$mail->AddReplyTo($email,$name);


if (!$mail->Send()) {
echo "<p>There was an error in sending mail, please try again at a later time</p>";
echo "<p>".$mail->ErrorInfo."</p>";
} else {
	;		
}

$mail->ClearAddresses();
$mail->ClearAttachments();
?>

<?php
echo '<meta HTTP-EQUIV="REFRESH" content="0; url=xxxx./mail.php">'
?>
Mail gönderilince sayfa yönlenmeden hemen f5 ve enter yapıldığında tekrar mail gönderiliyor. Sürekli basılırsa yüzlerce hatta binlerce gönderecek. Bu durum hem sunucuya zarar verir, hemde sunucudan hotmaile mail yönlendirdim, banlanmaya sebep olacak. Bu kodlara kesin çözüm uygulayabilir misiniz? Şu session olayını vs. Resimli güvenlik kodu doğrulaması koyulsa ilk forma koyulacak, sorun ikinci dosyada zaten. Bu arada ilk formda 15 saniye süreli zaman sayacı kullanıyorum. Gönder butonu 15 saniyede aktif oluyor.

TEŞEKKÜRLER.