邮件不会直接进入收件箱

时间:2012-11-16 17:10:35

标签: php email spam inbox

这是我的代码。当我从一个id向同一个id发送一封电子邮件时,电子邮件就会发送到垃圾邮件。无法识别此代码中的问题。例如,我发送这样的电子邮件

来自= abc@yahoo.com  至= abc@yahoo.com  然后它直接进入垃圾。

    <?php

     $name=$_POST['fName'];
     $yemail = $_POST['yEmail'];
     $femail=$_POST['fEmail'];
     $message=$_POST['message']; 
     $from=$yemail;
     $to=$femail;
     $subject="Invitation for you";
     $mailBody ="<table width='628' border='0'>

    <tr><td align='left' valign='middle'><p><br><br>Hello,<br><br>This email is a       notification to let you know that your friend has invited you to <br>visit this link <a      href=www.heed-association.org>Heed Association.</a><br><br> Your friend is using this to        help people living in Pakistan by donating some money.<br><br>So your can also contribute in the areas of Health, Education, Environment and Sustainable Development<br> in the earthquake affected areas of Kashmir to improve living conditions and alleviate community distress<br><br><hr><br><br><strong>Regards<br><br>Heed Association</p></td></tr></table>";

   $headers  = 'MIME-Version: 1.0' . "\r\n";

    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

   $headers .= 'From:  <'.$yemail.'>' . "\r\n";


   if (mail($to, $subject, $mailBody, $headers)) {

   echo "<script language='javascript'>
            window.location = 'index.php';
            </script>";


   } else {
    echo "<script language='javascript'>
            window.location = 'tell_a_form.php';
            </script>";
    }



    ?>

2 个答案:

答案 0 :(得分:2)

我会说检查您的垃圾邮件过滤器。听起来很傻,将电子邮件添加到安全发件人列表中。您的代码中似乎没有任何真正的时髦。

答案 1 :(得分:1)

这可能是一个过敏的垃圾邮件过滤器。许多程序可以检测电子邮件是否实际上不是从“发件人”列中列出的电子邮件地址发送的。通常,绕过这种情况的方法是让电子邮件来自“no-reply@yourdomain.com”。