enquiry.php如何使用基本的PHP發送電子郵件?
<form id="style_contact" method="POST" name="contactForm" action="sendmail.php" enctype="multipart/form-data">
<table width="100%" border="0" align="left">
<tr>
<td>Name<span style="color:#96070d; padding:5px;">*</span></td>
<td><input name="fname" type="text" placeholder="" class="feiald" /></td>
</tr>
<tr>
<td>Telephone<span style="color:#96070d; padding:5px;">*</span></td>
<td><input name="phone" type="text" placeholder="" class="feiald" value="" /></td>
</tr>
<tr>
<td>Mobile No<span style="color:#96070d; padding:5px;">*</span></td>
<td><input name="mobile" type="text" placeholder="" class="feiald" value="" /></td>
</tr>
<tr>
<td>Email<span style="color:#96070d; padding:5px;">*</span></td>
<td><input name="email" type="text" placeholder="" class="feiald" value="" /></td>
</tr>
<tr>
<td>Subject<span style="color:#96070d; padding:5px;">*</span></td>
<td><input name="subject" type="text" placeholder="" class="feiald" value="" /></td>
</tr>
<tr>
<td>Message<span style="color:#96070d; padding:5px;">*</span></td>
<td><textarea name="message" cols="36" rows="3" class="feiald" placeholder=""></textarea></td>
</tr>
<tr>
<td> </td>
<td><input class="button" type="submit" value="Submit" /></td>
</tr>
</table>
</form>
sendmail.php
<?php
$name = $_POST['fname'];
$telephone = $_POST['phone'];
$mobile = $_POST['mobile'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$msg = $_POST['message'];
$to = '[email protected]';
$message = 'Name : '.$name.'Telephone : '.$telephone.'Mobile No : '.$mobile.'Email : '.$email.'Message : '.$msg;
mail($to,$subject,$message);
header('location: enquiry.php?msg="Your message has been sent successfully!!"');
?>
我已經寫在基本的PHP發送電子郵件到電子郵件-ID代碼。我已經上傳到服務器上。但它不起作用。任何人都可以告訴這個代碼中的錯誤嗎?正在顯示消息「您的消息已成功發送」。但郵件不在收件箱中。
基本PHP'mail'功能是臭名昭著用於觸發垃圾郵件過濾器,特別是在Google中。你檢查過你的垃圾箱了嗎? –
你配置了像Exim這樣的郵件服務器嗎? – fito
垃圾箱裏沒有郵件。 – anumol