2016-11-12 1 views
0

J'utilise l'ensemble de règles d'Amazon SES pour diriger tous les messages envoyés à mon domaine vers un compartiment SES. J'essaie maintenant de lire ces fichiers par programme, mais je suis incapable de comprendre comment faire. J'ai étudié ce sujet et suis venu sur les fonctions de Mailparse de PHP. Mon code est le suivant:PHP: Analyser les messages provenant de fichiers enregistrés sur S3 par Amazon SES

$filnename = '/Users/R00tUser/Downloads/u38sf1l0jcd4s1tifl59a10psc16i7nfoaq2c64'; 
    $resource = mailparse_msg_parse_file($filename); 
    $parts = mailparse_msg_get_structure($resource); 
    var_dump($parts); 
    $text = mailparse_msg_extract_whole_part_file($resource, $filename); 
    var_dump($text); 

La sortie des deux l'var_dump est bool(false). Puisque la documentation de ces méthodes est presque inexistante, je ne sais pas ce qui ne va pas. Quelqu'un peut-il s'il vous plaît corriger les erreurs dans mon code ou s'il vous plaît suggérer une meilleure façon de faire ce que je suis en train de faire.

Contenu du fichier que j'essaie d'analyser:

Return-Path: <> 
Received: from mail1.dokia.com (mail1.dokia.com [212.63.232.3]) 
by inbound-smtp.us-east-1.amazonaws.com with SMTP id v1o5lrohq3e841no469t801 
for [email protected]; 
Thu, 03 Nov 2016 10:34:17 +0000 (UTC) 
X-SES-Spam-Verdict: PASS 
X-SES-Virus-Verdict: PASS 
Received-SPF: none (spfCheck: 212.63.232.3 is neither permitted nor denied by domain of mail1.dokia.com) client-ip=212.63.232.3; [email protected]; helo=mail1.dokia.com; 
Authentication-Results: amazonses.com; 
spf=none (spfCheck: 212.63.232.3 is neither permitted nor denied by domain of mail1.dokia.com) client-ip=212.63.232.3; [email protected]; helo=mail1.dokia.com; 
dkim=pass [email protected]; 
X-SES-RECEIPT: AEFBQUFBQUFBQUFGcHNSUkh4ShWRWNhN3djZ3hoUllvLzRyM0RXY3dNMER6OXBRcHNoZnBiRlQzbkNnUE1BK3B3TXgzYURnUE8yREFJd0ZJTW5SbWhaSm03dlE3cVljazE0QzVLbjhYNCsxdnRCdmc2M3o5bDI3ZVM4Nm1vK3BZdnUra1I1Wjc2MFo5VXA3c0psR0JaOGIvMWhmRThiMD0= 
X-SES-DKIM-SIGNATURE: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; 
    s=hkasda87d; d=amazonses.com; t=1478169251; 
    h=X-SES-RECEIPT:From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; 
    bh=Hywa/hajdiyfsdhjsdf+3Iz8=; 
    b=O/hjagdasd6hjasd 
    890adskajsd+hhjahda98789asd 
    hkjahdkjhasd987asdhjk+2Osk= 
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; 
    d=sender.be; q=dns/txt; s=sender; t=1478169257; 
    x=1509705257; 
    h=from:to:subject:date:message-id:references:in-reply-to: 
    mime-version:content-transfer-encoding; 
    bh=Hywa/ghjgsd87a6dasjhbakf+3Iz8=; 
    b=bbdksahiofds8fdfhjkaksd+h17EaoYrG 
    mnbxzcuiuasdyibjsiud/JhgsdufgIUIUhhdksfksdiu 
    OlsdjsdiThdklfj/hkasd876ihkjdfk/+Jkufd+rgruk 
    w=; 
From: "Sender Sender1" <[email protected]> 
To: Super User <[email protected]> 
Subject: Automatic reply: Special Situation 
Thread-Topic: Special Situation 
Thread-Index: KHHSDHkjsaduiad== 
Date: Thu, 3 Nov 2016 10:34:11 +0000 
Message-ID: <[email protected]et> 
References: <[email protected]> 
In-Reply-To: <[email protected]> 
X-MS-Has-Attach: 
X-Auto-Response-Suppress: All 
X-MS-Exchange-Inbox-Rules-Loop: [email protected] 
X-MS-TNEF-Correlator: 
Content-Type: text/plain; charset="us-ascii" 
MIME-Version: 1.0 
Content-Transfer-Encoding: quoted-printable 

And more so behind fox deliberately unwound took far because yikes cowered = 
much far firefly jeez revealed soggy away 
----------------------------------------------- 
https://www.google.com/doodles/358th-anniversary-of-tea-in-the-uk 
----------------------------------------------- 

Répondre