我正在尝试使用 php 发送电子邮件,但它不起作用。这是我的代码:
<form method="post" name="contact" action="#contact">
<div class="left">
<label for="author">Name:</label> <input name="nom" type="text" class="input_field" id="author" maxlength="40" />
</div>
<div class="right">
<label for="email">Email:</label> <input name="email" type="text" class="input_field" id="email" maxlength="40" />
</div>
<div class="clear"></div>
<label for="text">Message:</label> <textarea id="text" name="text" rows="0" cols="0"></textarea>
<input type="submit" class="submit_btn float_l" name="submit" id="submit" value="Send" />
</form>
<?php
$name= ($_POST["nom"]);
$mail= ($_POST["email"]);
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From:<nelson-book@outlook.fr>' . "\r\n";
$suject="Book";
$message = "Nom: <br/>" .$name. "email:<br/> " .$email. "message: " .$_POST["text"];
if (isset($_POST['submit'])) {
mail("nelson-book@outlook.fr", $suject, $message, $headers);
echo" teste";
}
?>
我已经使用了与这只蚂蚁类似的超级代码,它完全可以工作。问题可能出在服务器上吗?提前致谢。