如何知道php邮件是否失败 [英] how to know if php mail failed

查看:125
本文介绍了如何知道php邮件是否失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从php mail()发送邮件:如果发送失败,我想收到失败的邮件。

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 . "\r\n" .
    //         "X-Mailer: PHP/" . phpversion();

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


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

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

但是尽管 $ to 邮件不存在,它不显示失败!!

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

推荐答案

我想你想要的是检查一个真正的电子邮件,不仅是一个有效的格式化的电子邮件。所以我建议你看看这个博客

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

这篇关于如何知道php邮件是否失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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