在标题中找不到收件人地址 [英] No recipient addresses found in header

查看:207
本文介绍了在标题中找不到收件人地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用PHP邮件功能发送邮件时收到此错误



错误是: - 在标题中找不到收件人地址



请帮助我出来



这里是代码



//我的代码从这里开始

  $ to = navruk@gmail.com; 
$ subject = $ _POST ['txtsub'];
$ messgae = $ _POST ['txtmessage'];
$ signature = $ _POST ['txtsignature'];
$ redirect =thanks.php;
$ error =error.php;

$ body =< table width ='700'align ='center'cellpadding ='0'cellspacing ='0'border ='0'>
< tr>
< td valign ='top'>
$ messgae< br>
< / td>
< / tr>
< tr>
< td valign ='top'>
$签名< br>
< / td>
< / tr>
< / table> ;;

$ from =Aakrutisolutions< info@aakrutisolutions.com>;
$ headers =From:$ from\\\
;
$ headers。='MIME-Version:1.0'。 \r\\\
;
$ headers。=Content-type:text / html; charset = iso-8859-1\r\\\
;
$ headers。=Content-Transfer-Encoding:8bit\r\\\
;
$ headers。=X-Priority:1\r\\\
;
$ headers。=X-MSMail-Priority:High\\\\
;
$ headers。=X-Mailer:Just My Server\r
$ headers。=。$ body。\\\
;

if(mail($ to,$ subject,$ message,$ headers))
{
?>
< script language =javascript>
location.href ='bulkmail.php?sts = mailsent';
< / script>
<?php
}
else
{
?>
< script language =javascript>
location.href ='bulkmail.php?sts = mailnotsent';
< / script>
<?php

}

//我的代码在这里结束

解决方案

我可以理解评论中的讽刺意味,永远不要这样,我觉得行为不行就这样,即使答案很明显。很容易找到信息:

  $ headers ='From:Navruk< navruk@gmail.com>'。 \\\\。 
'至:Navruk1< navruk@gmail.com> Navruk2< navruk@gmail.com>'。 \\\\。
'Cc:Navruk3< navruk@gmail.com>'。 \\\\。
'Bcc:Navruk4< navruk@gmail.com>'。 \\\\。
'Reply-To:noreply@example.com'。 \\\\。
'X-Mailer:PHP /'。 phpversion();

邮件(
navruk@gmail.com,
如何做基本邮件,
我可以轻松地GOOGLE,找到这个LINK在顶部http://php.net/manual/en/function.mail.php。令人惊讶的是,它是PHP手册,如果我点击这个链接,我将不仅仅会发现如何使用PHP命令邮件,还有一些例子!这花了我大约10秒钟找到。,
$ headers
);

我建议你阅读消息,自己尝试,你能打败我10秒吗? / p>

I got this error while sending a mail using PHP mail function

Error Is:- No recipient addresses found in header

Please help me out

Here is the code

//my code starts from here

        $to  = navruk@gmail.com;
        $subject  = $_POST['txtsub'];
        $messgae  = $_POST['txtmessage'];
        $signature = $_POST['txtsignature'];
        $redirect = "thanks.php";
        $error    = "error.php";

            $body ="<table width='700' align='center' cellpadding='0' cellspacing='0' border='0'>
              <tr>
                <td valign='top'>
                      $messgae <br>
                </td>
              </tr>
              <tr>
                <td valign='top'>
                      $signature <br>
                </td>  
              </tr>
            </table>";

            $from      = "Aakrutisolutions<info@aakrutisolutions.com>";
            $headers  =  "From: $from\n";
            $headers .= 'MIME-Version: 1.0' . "\r\n";
            $headers .= "Content-type: text/html;charset=iso-8859-1\r\n"; 
            $headers .= "Content-Transfer-Encoding: 8bit\r\n";
            $headers .= "X-Priority: 1\r\n"; 
            $headers .= "X-MSMail-Priority: High\r\n"; 
            $headers .= "X-Mailer: Just My Server\r\n";
            $headers .= "".$body."\n";

                    if(mail($to, $subject, $message, $headers))
                    {
                        ?>
                        <script language="javascript">
                         location.href='bulkmail.php?sts=mailsent';
                        </script>
                        <?php
                    }
                    else
                    {
                        ?>
                        <script language="javascript">
                         location.href='bulkmail.php?sts=mailnotsent';
                        </script>
                        <?php

                    }

//My code ends here

解决方案

I can understand the sarcasm in the comments, never the less, I don't think it is okay to behave like that, even if the answer is obvious. It is very easy to find the information:

$headers = 'From: Navruk <navruk@gmail.com>' . "\r\n" .
           'To: Navruk1 <navruk@gmail.com>, Navruk2 <navruk@gmail.com>' . "\r\n" .
           'Cc: Navruk3 <navruk@gmail.com>' . "\r\n" .
           'Bcc: Navruk4 <navruk@gmail.com>' . "\r\n" .
           'Reply-To: noreply@example.com' . "\r\n" .
           'X-Mailer: PHP/' . phpversion();

mail(
       "navruk@gmail.com",
       "How to do basic mailing",
       "I can easily GOOGLE and find this LINK at the top http://php.net/manual/en/function.mail.php. Surprisingly, it is the PHP manual. If I CLICK this link I will find not only how to use the PHP command mail, but also a bunch of examples! This took me about 10 seconds to find.",
        $headers
      );

I suggest you read the message and try it yourself, can you beat my 10 seconds?!?

这篇关于在标题中找不到收件人地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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