0
我正在使用Amazon SES的規則集將發送到我的域的所有郵件都指向SES存儲桶。我現在試圖以編程方式閱讀這些文件,但我無法弄清楚如何去做。我研究了這個主題,並發現了PHP的Mailparse函數。我的代碼是這樣的:PHP:從Amazon SES保存到S3的文件中解析郵件
$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);
var_dump的輸出是bool(false)
。由於這些方法的文檔幾乎不存在,所以我不知道出了什麼問題。有人可以糾正我的代碼中的錯誤,或者請建議一個更好的方式來做我想做的事情。該文件的
內容我試圖解析:
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
-----------------------------------------------