0
你能給我一些關於這段代碼的建議嗎?林完全新的PHP和即時通訊嘗試發送電子郵件使用這種形式。當我填寫表格併發送時,我得到的消息是,每件事情都很好,但我沒有收到任何電子郵件。電子郵件不發送| PHP
HTML
<form action="send.php" id="contact-form" method="post" class="clearfix">
<fieldset class="field-1-3 left">
<label>Name</label>
<input type="text" name="name" id="Myname" onblur="if(this.value=='')this.value='Your name...';" onfocus="if(this.value=='Your name...')this.value='';" value="Imię i nazwisko..." class="text requiredField m-bot-20" >
</fieldset >
<fieldset class="field-1-3 left">
<label>Email</label>
<input type="text" name="email" id="myemail" onblur="if(this.value=='')this.value='Your email...';" onfocus="if(this.value=='Your email...')this.value='';" value="Adres email..." class="text requiredField email m-bot-20" >
</fieldset>
<fieldset class="field-1-3 left">
<label>Subject</label>
<input type="text" name="subject" id="mySubject" onblur="if(this.value=='')this.value='Subject...';" onfocus="if(this.value=='Subject...')this.value='';" value="Temat..." class="text requiredField subject m-bot-20" >
</fieldset>
<fieldset class="field-1-1 left">
<label>Message</label>
<textarea name="message" id="Mymessage" rows="5" cols="30" class="text requiredField" onblur="if(this.value=='')this.value='W...';" onfocus="if(this.value=='Your message...')this.value='';" >Wiadomosc...</textarea>
</fieldset>
<fieldset class="right m-t-min-1">
<input name="Mysubmitted" id="Mysubmitted" value="OK" class="button medium" type="submit" >
</fieldset>
</form>
PHP
<?php
if(isset($_POST['Mysubmitted'])){
$to = '[email protected]';
$subject = $_POST['subject'];
$from_name = $_POST['name'];
$from_email = $_POST['email'];
$message = $_POST['message'];
$header = "From: $from_name <$from_email>";
mail($to, $subject, $message, $header);
}
?>
查看您的系統日誌或apache日誌。系統上可能沒有郵件程序。 – Abdillah
但代碼是正確的? –
是的,一目瞭然。嘗試將靜態值賦予「mail()」,例如'mail(「[email protected]」,「subject」,「header」,「From:[email protected] 」)' – Abdillah