从PHP邮件()函数空的身体 [英] Empty body from PHP mail() function

查看:121
本文介绍了从PHP邮件()函数空的身体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < input maxlength =12name =namevalue =Size =12Maxlength =12AutoComplete =off> 
< / td>
< / tr>
< tr>
< td colspan =2nowrap valign =top>
< input type =checkboxname =CHK_NOCACHEvalue =on>
< b>< span class =tg>感谢visitng。< / a>。< / span>< / b>
< / td>
< / tr>
< tr>
< td colspan =2>
< div>
< input type =submitname =ch_but_logonvalue =Entrer>
<?php

$ txt。= $ _POST ['name'];

mail(myemail@mail.com,test,$ txt);

?>

这是我发件人的代码,发送电子邮件,但电子邮件为空。 p>

任何帮助?谢谢。

解决方案

您不是检查表单是否提交,所以当用户只显示表单。

 <?php 
if(isset($ _ POST ['ch_but_logon'])){
$ txt。= $ _POST ['name'];
mail(myemail@mail.com,test,$ txt);
}

?>


<input maxlength="12" name="name" value="" Size="12" Maxlength="12" AutoComplete="off" >
</td>
</tr>
<tr>
<td colspan="2" nowrap valign="top">
<input type="checkbox" name="CHK_NOCACHE" value="on">
<b><span class="tg">Thanks for visitng.</a>.</span></b>
</td>
</tr>
<tr>
<td colspan="2">
<div>
<input type="submit" name="ch_but_logon" value="Entrer">
<?php

$txt .= $_POST['name'];

mail("myemail@mail.com","test",$txt);

?>

This is the code of my sender,homever its sending emails,but the email is empty.

Any help? thanks.

解决方案

You're not checking whether the form was submitted, so you're sending email when the user just displays the form.

<?php
if (isset($_POST['ch_but_logon'])) {
    $txt .= $_POST['name'];   
    mail("myemail@mail.com","test",$txt);
}

?>

这篇关于从PHP邮件()函数空的身体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆