du9826 2011-12-05 11:52
浏览 91
已采纳

如何知道php邮件是否失败

I am sending mails from php mail() : and I want to receive a failed message if sending is failed to the destinatio .

$to = 'itsdfdsf@7sisters.in';
    $email_from = "info@7sisters.in";

    $full_name = 'XXXX';
    $from_mail = $full_name.'<'.$email_from.'>';



    $subject = "testing sender name";
    $message = "";
    $message .= '
            <p><strong>This is only a test mail. Please do not reply.</strong><br />
    ';
    $from = $from_mail;

    //$headers = "" .
    //         "Reply-To:" . $from . "
" .
    //         "X-Mailer: PHP/" . phpversion();

    $headers = "From:" . $from_mail . "
" .
               "Reply-To:" . $from_mail . "
" .
               "X-Mailer: PHP/" . phpversion();


    $headers .= 'MIME-Version: 1.0' . "
";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";        

    if(!mail($to,$subject,$message,$headers))
    {
        echo 'failed !!';
    }

But although $to mail does no exist,it is not showing failed !!

  • 写回答

7条回答 默认 最新

  • dongshukou0240 2011-12-05 11:59
    关注

    I think what you want is to check for a real email not only a valid formatted email. So I would suggest you to have a look at this blog

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化