عزيزم ببين شما دوتا سه تا كار بايد بكنيد .
1 . يك فايل Contact.php داشته باشيد تا برنامه از اون بخونه .
2 . يك صفحه كه كاربر اطلاعاتشو بنويسه و ه ميل شما بياد .
خوب آسون بود نه پس شروع ميكنيم .
اول كد زير رو در NotePad بيار و با نام contact.php ذخيره كن .
کد:
<?
$email_address = "Your E.mail";
$email_name = "YourSite name.COM - Visitor Contact";
$next_page = "thank.htm";
$body = "";
$body .= "Name: " . $name . "\n";
$body .= "Company: " . $company . "\n";
$body .= "Location: " . $location . "\n";
$body .= "Phone: " . $phone . "\n";
$body .= "eMail: " . $email . "\n";
$body .= "website: " . $website . "\n";
$body .= "Message:\n " . ereg_replace("\n", "\n ", $message) . "\n";
$headers = "";
$headers .= "From: " . $email_name . " <" . $email_address . ">\n";
$headers .= "X-Sender: <" . $email_address . ">\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "X-Priority: 1\n";
$headers .= "Return-Path: <" . $email_address . ">\n";
$headers .= "Content-Type: text/html; charset=UTF-8\n";
@mail($email_address, "Visitor eMail From YourSite name - Contact", "<pre>" . $body . "</pre>", $headers);
header("Location: " . $next_page);
?>
! = توجه داشته باشيد كه جاهايي كه لازم است رو بايد به دلخواه تغيير بديد .
حالا نوبت صفحه مورد نظر هست كه من براي شما سورس اونو ميزارم اينجا . اين صفحه رو با نام mailform.html ذخيره كنيد .
کد:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>MPSatan</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<tr>
<td><div align="center">
<table width="95%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFFFF">
<div align="center"></div>
<div align="justify">
</div>
<div align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">
<form method="post" action="./contact.php" onsubmit="return CheckForm(this);">
<table border="0" cellpadding="2" cellspacing="0" style="font-family: verdana, arial; fonr-size: 10px;">
<tr>
<td>Name:</td>
<td>
<input type="text" name="name" value="" size="20"></td>
</tr>
<tr>
<td>Company:</td>
<td>
<input type="text" name="company" value="" size="20"></td>
</tr>
<tr>
<td>Location:</td>
<td>
<input type="text" name="location" value="Iran." size="20"></td>
</tr>
<tr>
<td>Phone:</td>
<td>
<input type="text" name="phone" value="+98-" size="20"></td>
</tr>
<tr>
<td>eMail:</td>
<td>
<input type="text" name="email" value="" size="20"></td>
</tr>
<tr>
<td>Website:</td>
<td>
<input type="text" name="website" value="" size="20"></td>
</tr>
<tr>
<td valign="top">Message:</td>
<td><textarea rows="7" cols="45" style="width: 250px;" name="message"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input name="submit" type="submit" value="Send Message">
<input name="reset" type="reset" value="Reset"></td>
</tr>
</table>
<div align="center"></div>
</form>
</body>
</html>
! = همون طوري كه در كد بالا ميبينيد كاربر پس ارسال فرم به صفحه اي مثل thank.htm راهنمايي ميشه پس لطف كنيد يه صفحه با نام thank.htm درست كنيد و همراه فرم قرار بديد
حالا فرم ارسال اطلاعات شما آماده شده . اميدوارم كه كمكتون كرده باشم .
موفق باشيد .