كود PHP:
<?
$ip_contact_us_to = "webmaster@mzaaya.com"; //---------- عدل إلى إيميلك الخاص
$ip_contact_us_where = "thanks.htm"; // --------- اكتب هنا عنوان الصفحة التي فيها شكر للمتصل
if(isset($_POST['Submit'])){
$mail_body = "<div align=right dir=rtl>";
$mail_headers = "";
$mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
$mail_headers .= "From: ". $Name ."<" . $Email . ">" . "\r\n";
$mail_headers .= "MIME-Version: 1.0\r\n";
$mail_headers .= " X-Priority: ". $Priority . "\r\n";
foreach($_POST as $key => $val){
if($key <> 'Submit'){
$mail_body .= "<b>". $key . "</b><br>" . nl2br($val) . "<br>";
}
}
$mail_body .= "</div>";
$message = $mail_body;
if (isset($_FILES['file']))
{
$tmp_name = $_FILES['file']['tmp_name'];
$type = $_FILES['file']['type'];
$name = $_FILES['file']['name'];
$size = $_FILES['file']['size'];
if(is_uploaded_file($tmp_name)){
$f = 1;
$file = fopen($tmp_name,'rb');
$data = fread($file,filesize($tmp_name));
fclose($file);
$data = chunk_split(base64_encode($data));
$mail_headers .= "Content-Type: multipart/mixed;\r\n" .
" boundary=\"{$mime_boundary}\"";
$message = "توجد مرفقات مع هذه الرسالة ..\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/html; charset=\"windows-1256\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$mail_body . "\n\n";
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$type};\n" .
" name=\"{$name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
}
else $f = 0;
}
else $f = 0;
if($f == 0) {
$mail_headers .= "Content-Type: text/html; charset=\"windows-1256\"\r\n";
$message = $mail_body;
}
mail($ip_contact_us_to, "اتصال من موقع مزايا لخدمات التصمي", $message, $mail_headers);
}
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=$ip_contact_us_where\">";
?>