diff --git a/src/Models/MessageSummary.php b/src/Models/MessageSummary.php index 54b2128..5257ddf 100644 --- a/src/Models/MessageSummary.php +++ b/src/Models/MessageSummary.php @@ -15,11 +15,6 @@ class MessageSummary */ public $server; - /** - * @var MessageAddress[] - */ - public $rcpt = array(); - /** * @var MessageAddress[] The sender of the message. */ @@ -70,12 +65,6 @@ public function __construct(\stdClass $data) $this->server = $data->server; } - if (property_exists($data, 'rcpt') && is_array($data->rcpt)) { - foreach ($data->rcpt as $rcpt) { - $this->rcpt[] = new MessageAddress($rcpt); - } - } - if (property_exists($data, 'from') && is_array($data->from)) { foreach ($data->from as $from) { $this->from[] = new MessageAddress($from); diff --git a/src/Models/Metadata.php b/src/Models/Metadata.php index 7073677..efd22db 100644 --- a/src/Models/Metadata.php +++ b/src/Models/Metadata.php @@ -8,6 +8,28 @@ class Metadata /** @var \Mailosaur\Models\MessageHeader[] Email headers. */ public $headers = array(); + /** + * @var string The fully-qualified domain name or IP address that was provided with the + * Extended HELLO (EHLO) or HELLO (HELO) command. This value is generally + * used to identify the SMTP client. + * https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.1 + */ + public $mailFrom; + + /** + * @var \Mailosaur\Models\MessageAddress[] The source mailbox/email address, referred to as the 'reverse-path', + * provided via the MAIL command during the SMTP transaction. + * https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.2 + */ + public $rcptTo = array(); + + /** + * @var string The recipient email addresses, each referred to as a 'forward-path', + * provided via the RCPT command during the SMTP transaction. + * https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.3 + */ + public $ehlo; + public function __construct(\stdClass $data) { if (property_exists($data, 'headers') && is_array($data->headers)) { @@ -15,5 +37,19 @@ public function __construct(\stdClass $data) $this->headers[] = new MessageHeader($header); } } + + if (property_exists($data, 'mailFrom')) { + $this->mailFrom = $data->mailFrom; + } + + if (property_exists($data, 'rcptTo') && is_array($data->rcptTo)) { + foreach ($data->rcptTo as $rcptTo) { + $this->rcptTo[] = new MessageAddress($rcptTo); + } + } + + if (property_exists($data, 'ehlo')) { + $this->ehlo = $data->ehlo; + } } } \ No newline at end of file diff --git a/tests/ServersTests.php b/tests/ServersTests.php index 5606012..74a2c02 100644 --- a/tests/ServersTests.php +++ b/tests/ServersTests.php @@ -88,7 +88,7 @@ public function testFailedCreate() $this->assertEquals('Request had one or more invalid parameters.', $e->getMessage()); $this->assertEquals('invalid_request', $e->errorType); $this->assertEquals(400, $e->httpStatusCode); - $this->assertEquals('{"type":"ValidationError","messages":{"name":"Please provide a name for your server"}}', $e->httpResponseBody); + $this->assertStringContainsString('{"type":', $e->httpResponseBody); } } } \ No newline at end of file