PHP邮件功能未发送任何消息 [英] PHP mail function is not sending any messages
问题描述
我对问题很困惑,在使用 mail
php函数时,我没有收到任何电子邮件。
I'm confused with what the problem is, I'm not receiving any e-mail whilst using the mail
php function.
PHP
<?php
if (isset($_POST['ch_but_logon'])) {
$txt .= $_POST['named23'];
mail("email@email.com","test",$txt);
}
?>
HTML
<form action="mailer.php" method="post">
<input type="text" name="named23" size="12">
</form>
</td>
</tr>
<tr>
<td colspan="2" nowrap valign="top">
<input type="checkbox" name="CHK_NOCACHE" value="on">
</td>
</tr>
<tr>
<td colspan="2">
<div>
<input type="submit" name="ch_but_logon" value="Entrer">
@@@@ UPDATE @@@@@
@@@@UPDATE@@@@
更新的代码:索引
<form action="mailer.php" method="post">
<input type="text" name="named23" size="12">
</td>
</tr>
<tr>
<td colspan="2" nowrap valign="top">
<input type="checkbox" name="CHK_NOCACHE" value="on">
</td>
</tr>
<tr>
<td colspan="2">
<div>
<input type="submit" name="ch_but_logon" value="Entrer">
</form>
MAILER.PHP
MAILER.PHP
<?php
if (isset($_POST['ch_but_logon'])) {
$txt = $_POST['named23'];
mail("psadsaxu@yahoo.sds","test",$txt);
}
?>
但是现在,它不再发送电子邮件了。
But now again,it's not sending email. Not receiving anything.
推荐答案
您的HTML无效。表格外不能包含< td>
和< tr>
,但< / tr>
和< / td>
。这些标签必须正确嵌套。如果嵌套不正确,浏览器会将所有必要的结束标记添加到内部标记中。这样的结果是您的表单将在 named23
元素之后结束,并且复选框和提交按钮不属于表单。
Your HTML is not valid. You can't have <td>
and <tr>
outside the form, but </tr>
and </td>
inside the form. These tags have to be nested properly. When you don't nest correctly, the browser will add all the necessary end tags to the inner tags. The result of this is that your form is ending after the named23
element, and the checkbox and submit button are not part of the form.
您应该将整个表格放在< form> ...< / form>
标记内。
You should put the entire table inside the <form>...</form>
tags.
这篇关于PHP邮件功能未发送任何消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!