<?php
$admin_email = "YourEmail";
if(isset($_POST['submit_msg']))
{
if (empty($HTTP_POST_VARS['name_msg'])){
die('<font face="Tahoma" color="#003399" style="font-size: 9pt">لطفا نام خود را وارد نمایید.</font>');
};
if (empty($HTTP_POST_VARS['email_msg'])){
die('<font face="Tahoma" color="#003399" style="font-size: 9pt">لطفا ایمیل خود را وارد نمایید.</font>');
};
if (empty($HTTP_POST_VARS['msg_body'])){
die('<font face="Tahoma" color="#003399" style="font-size: 9pt">لطفا پیام خود را وارد نمایید.</font>');
};
$name_msg = htmlspecialchars($HTTP_POST_VARS['name_msg']);
$name_msg = str_replace("&","&",$name_msg);
$name_msg = str_replace("ی","ي",$name_msg);
$msg_body = htmlspecialchars($HTTP_POST_VARS['msg_body']);
$msg_body = str_replace("&","&",$msg_body);
$msg_body = str_replace("ی","ي",$msg_body);
$msg_body = nl2br($msg_body);
// check empty for url...
if (!empty($HTTP_POST_VARS['url_msg']))
{
$url_msg = str_replace('http://','',$_POST['url_msg']);
$name_msg = "<a target=_blank href=http://".htmlspecialchars($url_msg).">".$name_msg."</a>";
}
if(!strpos($_POST['email_msg'],"@"))
{
print("<font color=#ff0000 face=tahoma >ایمیل ورودی نا معتبر است!");
die("<br><br>Example : [email protected] </font>");
};
$from = htmlspecialchars($HTTP_POST_VARS['email_msg']);
// start of Email Body...
$body = '<html><head><title>.:| Contact |:.</title><base target="_blank"></head>
<body text="#000000">
<p align="right" dir="rtl"><font face="Tahoma" size="2">سلام
به دوست عزیزم
یک نفر برای شما پیامی ارسال نموده است.</font></p>
<p align="right" dir="rtl"><font face="Tahoma" size="2">نام :
'.$name_msg.'</font></p>
<p align="right" dir="rtl"><font face="Tahoma" size="2">پیام :
</font></p>
<p align="right" dir="rtl"><font face="Tahoma" size="2" color="#003399">'.$msg_body.'</font></p>
<p align="center" dir="rtl"> </p>
<p align="center" dir="rtl"><font face="Tahoma" style="font-size: 9pt">با آرزوی
موفقیت برای شما</font></p>
<p align="center" dir="rtl">
<font face="Tahoma" color="#003399" style="font-size: 9pt">
<a href="http://www.hothost.ir/">هات هاست</a></font></p>
</body>
</html>';
//End of Email Body ...
if(!mail($admin_email,'New Contact',$body,"From: <$from>\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=utf-8"))
{
print("The Mail Could not be send.");
}else
{
print('<font face="Tahoma" color="#003399" style="font-size: 9pt">پیام شما با موفقیت برای مدیر سایت ارسال شد.</font>');
}
}//End of set Submit...
else
{
?>
<html>
<head>
<title>Contact Us ...</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="fa">
<style>
.TEXT{
font-family:Tahoma; font-size:9pt;
}
</style>
</head>
<body>
<form name="msg_form" method="POST" >
<div align="center">
<table border="0" width="359" cellpadding="2">
<tr>
<td width="242" dir="rtl"><font face="Tahoma"><span style="font-size: 9pt">
<input name="name_msg" size="22" class="TEXT" dir="rtl" tabindex="1" maxlength="35" lang="fa" style="float: right"></span></font></td>
<td dir="rtl">
<p dir="rtl" align="center"><font face="Tahoma"><span style="font-size: 9pt">نام
شما<font color="#FF0000">
<span lang="en-us">*</span></font></span></font></p></td>
</tr>
<tr>
<td width="242" dir="rtl">
<p align="right"><font face="Tahoma"><span style="font-size: 9pt">
<input type="text" name="url_msg" size="22" dir="ltr" tabindex="2" maxlength="30" class="TEXT"></span></font></td>
<td dir="rtl">
<p dir="ltr" align="center"><span lang="en-us">
<font face="Tahoma" style="font-size: 9pt">Web</font></span></td>
</tr>
<tr>
<td width="242" dir="rtl"><font face="Tahoma"><span style="font-size: 9pt">
<input name="email_msg" size="22" dir="ltr" tabindex="3" maxlength="40" class="TEXT" style="float: right"></span></font></td>
<td dir="rtl"><p dir="ltr" align="center">
<font face="Tahoma"><span style="font-size: 9pt"><font color="#FF0000">
<span lang="en-us">*</span> </font></span></font>
<font face="Tahoma" style="font-size: 9pt"><span lang="en-us">Email</span></font></p>
</td>
</tr>
<tr>
<td width="242" dir="rtl">
<p align="right"><font face="Tahoma"><span style="font-size: 9pt">
<textarea rows="5" name="msg_body" cols="33" dir="rtl" class="TEXT" tabindex="4" lang="fa"></textarea></span></font></td>
<td dir="rtl">
<p align="center"><font face="Tahoma"><span style="font-size: 9pt">
پیام شماd<font color="#FF0000"><span lang="en-us">*</span></font></span></font></td>
</tr>
</table>
</div>
<p dir="rtl" align="center">
<input type="reset" value="reset" name="reset_btn" ><input type="submit" value="Submit" name="submit_msg" tabindex="5" ></p></form>
<?php
}//End of Else...
?>
</body>
</html>