Skip to content

Commit eb70720

Browse files
committed
Add new metadata values
1 parent 5620be9 commit eb70720

File tree

3 files changed

+37
-12
lines changed

3 files changed

+37
-12
lines changed

src/Models/MessageSummary.php

-11
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ class MessageSummary
1515
*/
1616
public $server;
1717

18-
/**
19-
* @var MessageAddress[]
20-
*/
21-
public $rcpt = array();
22-
2318
/**
2419
* @var MessageAddress[] The sender of the message.
2520
*/
@@ -70,12 +65,6 @@ public function __construct(\stdClass $data)
7065
$this->server = $data->server;
7166
}
7267

73-
if (property_exists($data, 'rcpt') && is_array($data->rcpt)) {
74-
foreach ($data->rcpt as $rcpt) {
75-
$this->rcpt[] = new MessageAddress($rcpt);
76-
}
77-
}
78-
7968
if (property_exists($data, 'from') && is_array($data->from)) {
8069
foreach ($data->from as $from) {
8170
$this->from[] = new MessageAddress($from);

src/Models/Metadata.php

+36
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,48 @@ class Metadata
88
/** @var \Mailosaur\Models\MessageHeader[] Email headers. */
99
public $headers = array();
1010

11+
/**
12+
* @var string The fully-qualified domain name or IP address that was provided with the
13+
* Extended HELLO (EHLO) or HELLO (HELO) command. This value is generally
14+
* used to identify the SMTP client.
15+
* https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.1
16+
*/
17+
public $mailFrom;
18+
19+
/**
20+
* @var \Mailosaur\Models\MessageAddress[] The source mailbox/email address, referred to as the 'reverse-path',
21+
* provided via the MAIL command during the SMTP transaction.
22+
* https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.2
23+
*/
24+
public $rcptTo = array();
25+
26+
/**
27+
* @var string The recipient email addresses, each referred to as a 'forward-path',
28+
* provided via the RCPT command during the SMTP transaction.
29+
* https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.3
30+
*/
31+
public $ehlo;
32+
1133
public function __construct(\stdClass $data)
1234
{
1335
if (property_exists($data, 'headers') && is_array($data->headers)) {
1436
foreach ($data->headers as $header) {
1537
$this->headers[] = new MessageHeader($header);
1638
}
1739
}
40+
41+
if (property_exists($data, 'mailFrom')) {
42+
$this->mailFrom = $data->mailFrom;
43+
}
44+
45+
if (property_exists($data, 'rcptTo') && is_array($data->rcptTo)) {
46+
foreach ($data->rcptTo as $rcptTo) {
47+
$this->rcptTo[] = new MessageAddress($rcptTo);
48+
}
49+
}
50+
51+
if (property_exists($data, 'ehlo')) {
52+
$this->ehlo = $data->ehlo;
53+
}
1854
}
1955
}

tests/ServersTests.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function testFailedCreate()
8888
$this->assertEquals('Request had one or more invalid parameters.', $e->getMessage());
8989
$this->assertEquals('invalid_request', $e->errorType);
9090
$this->assertEquals(400, $e->httpStatusCode);
91-
$this->assertEquals('{"type":"ValidationError","messages":{"name":"Please provide a name for your server"}}', $e->httpResponseBody);
91+
$this->assertStringContainsString('{"type":', $e->httpResponseBody);
9292
}
9393
}
9494
}

0 commit comments

Comments
 (0)