Retrieve bounce notification / report in php
I am designing a application that **capture the error deliver message from the mail box**, I have done some studies in it but I still can not filter them out , there seems to be **no standard in it so I can not get /filter them** ?:

1. How to differentiate between normal mail (eg. my friend send me a mail with phrase 'failure' and actual bounce notification mail?

2. If problem 1 can not fixed easily, then I create a separate account to handle this, but are there any way to handle the report? (I can only just use regular express of mail to get the fail deliver destination and use 'failure ' ' code' as an filter?)

Thank you for help. I am inexperience in this kind of job ? 


Yahoo

        Sorry, we were unable to deliver your message to the following address.
    
    <foodil@dddddd.com>:
    Mail server for "dddddd.com" unreachable for too long
    
    --- Below this line is a copy of the message.
    
    Received: from [106.10.166.120] by nm22.bullet.mail.sg3.yahoo.com with NNFMP; 29 Feb 2012 09:04:06 -0000
    Received: from [106.10.167.232] by tm9.bullet.mail.sg3.yahoo.com with NNFMP; 29 Feb 2012 09:04:06 -0000
    Received: from [127.0.0.1] by smtp205.mail.sg3.yahoo.com with NNFMP; 29 Feb 2012 09:04:06 -0000
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.hk; s=s1024; t=1330506246; bh=znnAxTAuKSnliGq49apM7Ii1ERAlZxBv4cYit3wgR/g=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Message-ID:Date:Subject:From:To:MIME-Version:Content-Type; b=RXRjooHw6FSIX3zGXno0Uc0LLDwmfASQUP+6/1ZqNSHCLcEWzdfVitC0GhxzzwgVwoGxYAxyej/fagjOYUG1V476IKvLFwT2mc7V73nlLmFdo9UV185+QufcC9SFz+/qlgzy1vVYwrKo2Xm7/xZOFVVikFo1sbn0EKjus5GglnI=
    X-Yahoo-Newman-Id: 523716.94781.bm@smtp205.mail.sg3.yahoo.com
    X-Yahoo-Newman-Property: ymail-3
    X-YMail-OSG: PB_6KyYVM1mf3BcmrbsDUUD94qa2mYVScNnQNXoaj.YxW7w
    8yXbdApm_0pTB_sYvXKZZQq8JLeGZi4kAeFTwI4U52w9O5G4LJFXiSDEg6O5
    2X8Bu8y84ZpZSa5qCi.1cjMWo7cV7CLX5SzG4CijG41iSFpIhwna1U.z9dx1
    8shvWd28JkxnLtU7PaRdxPURHFm1nV8kYyWIqYLBp5wM0qUrJJo9XsRY.Bg8
    EwEnqvdsYvejJ9YIGDZHn6FzBsyfYmSxnrxrM9M.TS7pDZTKDoPYi7VUOwM_
    aoLMYr6UrNmQyOBQIRB_5CBV920o_6tnpeXKCMT1OJrM.pZEU6Uoow581AZU
    AVdmW7zvK2JC_hU.zL1J8LGuNdzV2T65etkN3WT.3Olm81AG.AzK1odnTIuT
    o
    X-Yahoo-SMTP: zNQ.D62swBB.riCml7vVOaU.Pw--
    Received: from [::1] (foodil@168.70.100.57 with login)
            by smtp205.mail.sg3.yahoo.com with SMTP; 29 Feb 2012 01:04:06 -0800 PST
    Message-ID: <1330506198.4f4de9d6a922e@localhost>
    Date: Wed, 29 Feb 2012 10:03:17 +0100
    Subject: ttt
    From: tester <foodil@yahoo.com.hk>
    To: foodil@dddddd.com
    MIME-Version: 1.0
    Content-Type: multipart/alternative;
    boundary="_=_swift_v4_13305061974f4de9d591f49_=_"
    
    
    --_=_swift_v4_13305061974f4de9d591f49_=_
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: quoted-printable
    
    test in plain text
    
    --_=_swift_v4_13305061974f4de9d591f49_=_
    Content-Type: text/html; charset=utf-8
    Content-Transfer-Encoding: quoted-printable
    
    Hello , ttttt,Here is a testing mail , ttttt, Unsubscribe from <a href=3Dl=
    ocalhost/fyp/unsub.php?code=3DcQfSoQmeopetSvVCNWMRqFQmxqhllOUH0zo4MqdN> li=
    nk</a>
    
    --_=_swift_v4_13305061974f4de9d591f49_=_--

Gmail

        Delivery to the following recipient failed permanently:
    
        sewdcxerqerer23@hotmail.com
    
    Technical details of permanent failure:
    Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 550 550 Requested action not taken: mailbox unavailable (state 14).
    
    ----- Original message -----
    
    Received-SPF: pass (google.com: domain of foodilnew@gmail.com designates 10.68.228.193 as permitted sender) client-ip=10.68.228.193;
    Authentication-Results: mr.google.com; spf=pass (google.com: domain of foodilnew@gmail.com designates 10.68.228.193 as permitted sender) smtp.mail=foodilnew@gmail.com; dkim=pass header.i=foodilnew@gmail.com
    Received: from mr.google.com ([10.68.228.193])
           by 10.68.228.193 with SMTP id sk1mr4178326pbc.60.1330506479278 (num_hops = 1);
           Wed, 29 Feb 2012 01:07:59 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
           d=gmail.com; s=gamma;
           h=message-id:date:subject:from:to:mime-version:content-type;
           bh=mTAZjN0yOMSZvZ93QlxjKHpcMuoOOMgF3ae4S5LrPpM=;
           b=f1B4X5p0Unf+Yx3G+BHwsc6mn5x793Ezm60qIxoTX5Xb7fmORq5tPiihiNLNef0d7V
            5+g6iVIa1MduQKbtrVKUFmkc163rSRpC2nzW+RERE8KhY/4BVY1tvR1pI4sqcljXzWZm
            +sDvEotPrmn+m/AdRnPaCN44eGZ6xDv2SPUUE=
    Received: by 10.68.228.193 with SMTP id sk1mr3539133pbc.60.1330506479252;
           Wed, 29 Feb 2012 01:07:59 -0800 (PST)
    Return-Path: <foodilnew@gmail.com>
    Received: from [::1] ([168.70.100.57])
           by mx.google.com with ESMTPS id f6sm2760781pbt.4.2012.02.29.01.07.56
           (version=SSLv3 cipher=OTHER);
           Wed, 29 Feb 2012 01:07:58 -0800 (PST)
    Message-ID: <1330506428.4f4deabc28e7e@localhost>
    Date: Wed, 29 Feb 2012 10:06:58 +0100
    Subject: ttt
    From: tester <foodilnew@gmail.com>
    To: sewdcxerqerer23@hotmail.com
    MIME-Version: 1.0
    Content-Type: multipart/alternative;
     boundary="_=_swift_v4_13305064184f4deab2410ee_=_"
    
    test in plain text
Retrieve bounce notification / report in php
===

I am designing a application that **capture the error deliver message from the mail box**, I have done some studies in it but I still can not filter them out , there seems to be **no standard in it so I can not get /filter them** ?:

1. How to differentiate between normal mail (eg. my friend send me a mail with phrase 'failure' and actual bounce notification mail?

2. If problem 1 can not fixed easily, then I create a separate account to handle this, but are there any way to handle the report? (I can only just use regular express of mail to get the fail deliver destination and use 'failure ' ' code' as an filter?)

Thank you for help. I am inexperience in this kind of job ? 


Yahoo

        Sorry, we were unable to deliver your message to the following address.
    
    <foodil@dddddd.com>:
    Mail server for "dddddd.com" unreachable for too long
    
    --- Below this line is a copy of the message.
    
    Received: from [106.10.166.120] by nm22.bullet.mail.sg3.yahoo.com with NNFMP; 29 Feb 2012 09:04:06 -0000
    Received: from [106.10.167.232] by tm9.bullet.mail.sg3.yahoo.com with NNFMP; 29 Feb 2012 09:04:06 -0000
    Received: from [127.0.0.1] by smtp205.mail.sg3.yahoo.com with NNFMP; 29 Feb 2012 09:04:06 -0000
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.hk; s=s1024; t=1330506246; bh=znnAxTAuKSnliGq49apM7Ii1ERAlZxBv4cYit3wgR/g=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Message-ID:Date:Subject:From:To:MIME-Version:Content-Type; b=RXRjooHw6FSIX3zGXno0Uc0LLDwmfASQUP+6/1ZqNSHCLcEWzdfVitC0GhxzzwgVwoGxYAxyej/fagjOYUG1V476IKvLFwT2mc7V73nlLmFdo9UV185+QufcC9SFz+/qlgzy1vVYwrKo2Xm7/xZOFVVikFo1sbn0EKjus5GglnI=
    X-Yahoo-Newman-Id: 523716.94781.bm@smtp205.mail.sg3.yahoo.com
    X-Yahoo-Newman-Property: ymail-3
    X-YMail-OSG: PB_6KyYVM1mf3BcmrbsDUUD94qa2mYVScNnQNXoaj.YxW7w
    8yXbdApm_0pTB_sYvXKZZQq8JLeGZi4kAeFTwI4U52w9O5G4LJFXiSDEg6O5
    2X8Bu8y84ZpZSa5qCi.1cjMWo7cV7CLX5SzG4CijG41iSFpIhwna1U.z9dx1
    8shvWd28JkxnLtU7PaRdxPURHFm1nV8kYyWIqYLBp5wM0qUrJJo9XsRY.Bg8
    EwEnqvdsYvejJ9YIGDZHn6FzBsyfYmSxnrxrM9M.TS7pDZTKDoPYi7VUOwM_
    aoLMYr6UrNmQyOBQIRB_5CBV920o_6tnpeXKCMT1OJrM.pZEU6Uoow581AZU
    AVdmW7zvK2JC_hU.zL1J8LGuNdzV2T65etkN3WT.3Olm81AG.AzK1odnTIuT
    o
    X-Yahoo-SMTP: zNQ.D62swBB.riCml7vVOaU.Pw--
    Received: from [::1] (foodil@168.70.100.57 with login)
            by smtp205.mail.sg3.yahoo.com with SMTP; 29 Feb 2012 01:04:06 -0800 PST
    Message-ID: <1330506198.4f4de9d6a922e@localhost>
    Date: Wed, 29 Feb 2012 10:03:17 +0100
    Subject: ttt
    From: tester <foodil@yahoo.com.hk>
    To: foodil@dddddd.com
    MIME-Version: 1.0
    Content-Type: multipart/alternative;
    boundary="_=_swift_v4_13305061974f4de9d591f49_=_"
    
    
    --_=_swift_v4_13305061974f4de9d591f49_=_
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: quoted-printable
    
    test in plain text
    
    --_=_swift_v4_13305061974f4de9d591f49_=_
    Content-Type: text/html; charset=utf-8
    Content-Transfer-Encoding: quoted-printable
    
    Hello , ttttt,Here is a testing mail , ttttt, Unsubscribe from <a href=3Dl=
    ocalhost/fyp/unsub.php?code=3DcQfSoQmeopetSvVCNWMRqFQmxqhllOUH0zo4MqdN> li=
    nk</a>
    
    --_=_swift_v4_13305061974f4de9d591f49_=_--

Gmail

        Delivery to the following recipient failed permanently:
    
        sewdcxerqerer23@hotmail.com
    
    Technical details of permanent failure:
    Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 550 550 Requested action not taken: mailbox unavailable (state 14).
    
    ----- Original message -----
    
    Received-SPF: pass (google.com: domain of foodilnew@gmail.com designates 10.68.228.193 as permitted sender) client-ip=10.68.228.193;
    Authentication-Results: mr.google.com; spf=pass (google.com: domain of foodilnew@gmail.com designates 10.68.228.193 as permitted sender) smtp.mail=foodilnew@gmail.com; dkim=pass header.i=foodilnew@gmail.com
    Received: from mr.google.com ([10.68.228.193])
           by 10.68.228.193 with SMTP id sk1mr4178326pbc.60.1330506479278 (num_hops = 1);
           Wed, 29 Feb 2012 01:07:59 -0800 (PST)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
           d=gmail.com; s=gamma;
           h=message-id:date:subject:from:to:mime-version:content-type;
           bh=mTAZjN0yOMSZvZ93QlxjKHpcMuoOOMgF3ae4S5LrPpM=;
           b=f1B4X5p0Unf+Yx3G+BHwsc6mn5x793Ezm60qIxoTX5Xb7fmORq5tPiihiNLNef0d7V
            5+g6iVIa1MduQKbtrVKUFmkc163rSRpC2nzW+RERE8KhY/4BVY1tvR1pI4sqcljXzWZm
            +sDvEotPrmn+m/AdRnPaCN44eGZ6xDv2SPUUE=
    Received: by 10.68.228.193 with SMTP id sk1mr3539133pbc.60.1330506479252;
           Wed, 29 Feb 2012 01:07:59 -0800 (PST)
    Return-Path: <foodilnew@gmail.com>
    Received: from [::1] ([168.70.100.57])
           by mx.google.com with ESMTPS id f6sm2760781pbt.4.2012.02.29.01.07.56
           (version=SSLv3 cipher=OTHER);
           Wed, 29 Feb 2012 01:07:58 -0800 (PST)
    Message-ID: <1330506428.4f4deabc28e7e@localhost>
    Date: Wed, 29 Feb 2012 10:06:58 +0100
    Subject: ttt
    From: tester <foodilnew@gmail.com>
    To: sewdcxerqerer23@hotmail.com
    MIME-Version: 1.0
    Content-Type: multipart/alternative;
     boundary="_=_swift_v4_13305064184f4deab2410ee_=_"
    
    test in plain text