Skip to content

Commit cc5c093

Browse files
committed
Adapt to changes in input format
1 parent aa4c39e commit cc5c093

File tree

2 files changed

+34
-32
lines changed

2 files changed

+34
-32
lines changed

example-mail.txt

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
From SRS0=KoVRPd=EC=somedomain.ch=[email protected] Tue Oct 27 21:54:31 2020
2-
Received: from mail-gateway-shared14.cyon.net ([194.126.200.67]:57144)
1+
From [email protected] Thu Jul 06 21:43:28 2023
2+
Received: from mail-gateway-shared03.cyon.net ([194.126.200.53]:48136)
33
by s076.cyon.net with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
4-
(Exim 4.93)
4+
(Exim 4.96)
55
(envelope-from <[email protected]>)
6-
id 1kXVzD-00AaqD-B4
7-
for [email protected]; Tue, 27 Oct 2020 21:54:31 +0100
6+
id 1qHUsy-0095Mw-09
7+
8+
Thu, 06 Jul 2023 21:43:28 +0200
89
Received: from s076.cyon.net ([149.126.4.85])
9-
by mail-gateway-shared14.cyon.net with esmtpsa (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
10+
by mail-gateway-shared03.cyon.net with esmtpsa (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
1011
(Exim)
1112
(envelope-from <[email protected]>)
12-
id 1kXVzB-0000Mk-J2
13-
for [email protected]; Tue, 27 Oct 2020 21:54:31 +0100
13+
id 1qHUsx-0006do-1M
14+
15+
Thu, 06 Jul 2023 21:43:27 +0200
1416
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
15-
d=somedomain.ch; s=default; h=Content-Transfer-Encoding:Content-Type:
16-
MIME-Version:Date:Message-ID:To:Subject:From:Sender:Reply-To:Cc:Content-ID:
17-
Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
18-
:Resent-Message-ID:In-Reply-To:References;
19-
bh=6lMbKl0kTAdA7DrjEgxU0McE4tJeWL2b6aGuw0au4vo=; b=DoYK7KvnjeoOPoJMmuIjt8B1kz
20-
BtEO79uvsyfX62zmkOM0CmoSOEAVctWoXno3CRX2JJ6w7B6dubYR76+/qV8SOKMraxrppYwSdJiil
21-
FdQV7fDGeC65zRAvAKWKefkq/3VUYfhIxZQYihaV3kz7eUm0rA3NcceHFh+UM1RgYZebsXW17y7DB
22-
mvFEu+e9ntAFKWOk1lQ0VX2A697sM92vOmXUv7y+U7aDcz9EsRb0FHAmBUwXRK4LBbr6XyYk7/+h7
23-
xMfj/YGdtKbqFx5QKrtThfrl3AxPeyuXJzLqdBWrRFqEHcd0zvMX7OqPWWUsjY3ZREqXrWUEOF+mQ
24-
YwD7oW8g==;
25-
Received: from [10.20.10.231] (port=44254 helo=mail.cyon.ch)
26-
by s076.cyon.net with esmtpa (Exim 4.93)
17+
d=somedomain.ch; s=default; h=Content-Transfer-Encoding:Content-Type:Subject:
18+
From:To:MIME-Version:Date:Message-ID:Sender:Reply-To:Cc:Content-ID:
19+
Content-Description; bh=6lMbKl0kTAdA7DrjEgxU0McE4tJeWL2b6aGuw0au4vo=; b=QVMK6
20+
ZvSkSmSMMXKKUkwEdltumlNJAuVV4ngtJbnESnjjkpMK6rZUtNdbviCenMHhKdeCi4vRVJvRBRgG4
21+
4lRTUsIhHez+0a9nn/QKVm3Z6XJzjdTGwawkhu72H8yOrJc8e2UinH29BozmjgyLWXgr08jVY3A7r
22+
321kkeXpM8dU/MtkWt2VuhrZdeYqZFtX6EAzzr3ef4PP4oi97msJXRFEqbSDPvxOnrqbVTs0jjOgm
23+
eBd4SfqZrr9ZlJNfpqhz9J5v4OKlSRdbOnTCOUyabkkAYzzuBzSeL8kdYqgdnd0sxwobDHSNFhJ4j
24+
OJoZnLeLXtsAE00THrL2awoHjxUsA==;
25+
Received: from [10.20.10.232] (port=53214 helo=mail.cyon.ch)
26+
by s076.cyon.net with esmtpa (Exim 4.96)
2727
(envelope-from <[email protected]>)
28-
id 1kXVzA-00Aap7-EG
29-
for [email protected]; Tue, 27 Oct 2020 21:54:28 +0100
28+
id 1qHUsw-0095MS-0l
29+
30+
Thu, 06 Jul 2023 21:43:26 +0200
31+
Message-ID: <[email protected]>
32+
Date: Thu, 6 Jul 2023 21:43:25 +0200
33+
MIME-Version: 1.0
34+
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
35+
Firefox/102.0 Thunderbird/102.11.0
36+
Content-Language: en-US
37+
3038
From: someone <[email protected]>
3139
Subject: Hello World
32-
33-
Message-ID: <[email protected]>
34-
Date: Tue, 27 Oct 2020 21:54:28 +0100
35-
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
36-
Firefox/68.0 Thunderbird/68.10.0
37-
MIME-Version: 1.0
38-
Content-Type: text/plain; charset=utf-8
40+
Content-Type: text/plain; charset=UTF-8; format=flowed
3941
Content-Transfer-Encoding: 8bit
40-
Content-Language: en-US
4142
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
4243
X-AntiAbuse: Primary Hostname - s076.cyon.net
4344
X-AntiAbuse: Original Domain - somedomain.ch
4445
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
4546
X-AntiAbuse: Sender Address Domain - somedomain.ch
4647
X-Get-Message-Sender-Via: s076.cyon.net: authenticated_id: [email protected]
4748
X-Authenticated-Sender: s076.cyon.net: [email protected]
48-
X-OutGoing-Spam-Status: No, score=-1.1
4949

5050
Hoi zäme
5151

index.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function send_message($message, $firstLine, $recipients) {
6060
if (count($recipients) === 0) return;
6161
$recipientAddresses = array_map(function($recipient) { return new Address($recipient); }, $recipients);
6262

63-
if (!preg_match('/^From [^ ]+=([^= ]+) /', $firstLine, $matches)) return;
63+
if (!preg_match('/^From ([^ ]+) /', $firstLine, $matches)) return;
6464
$sender = new Address($matches[1]);
6565
$envelope = new Envelope($sender, $recipientAddresses);
6666

@@ -81,6 +81,8 @@ function send_message($message, $firstLine, $recipients) {
8181
//$outfile = fopen(__DIR__ . '/mail.txt', 'a');
8282
//fwrite($outfile, "Mail received for list id $LIST_ID\n");
8383
[$message, $firstLine] = read_message($stdin);
84+
//fwrite($outfile, $firstLine);
85+
//fwrite($outfile, $message);
8486

8587
$recipients = fetch_mailing_list_subscribers($_ENV['HITOBITO_API_BASE_URL'], $_ENV['GROUP_ID'], $LIST_ID, $_ENV['API_TOKEN']);
8688

0 commit comments

Comments
 (0)