From f51fbfa43ee1c3226ca523ed613a59423fceaaff Mon Sep 17 00:00:00 2001 From: Mohamed Radwan Date: Tue, 21 Feb 2023 17:20:48 +0200 Subject: [PATCH] adding snipping attribute to mail --- src/Services/Message/Mail.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Services/Message/Mail.php b/src/Services/Message/Mail.php index 34dbdc6..bd2b8a4 100644 --- a/src/Services/Message/Mail.php +++ b/src/Services/Message/Mail.php @@ -71,6 +71,11 @@ class Mail extends GmailConnection public $parts; + /** + * @var + */ + public $snippet; + /** * @var Google_Service_Gmail */ @@ -130,6 +135,7 @@ protected function setMessage(\Google_Service_Gmail_Message $message) $this->threadId = $message->getThreadId(); $this->historyId = $message->getHistoryId(); $this->payload = $message->getPayload(); + $this->snippet = $message->getSnippet(); if ($this->payload) { $this->parts = collect($this->payload->getParts()); } @@ -231,6 +237,18 @@ public function getReplyTo() return $this->getFrom($replyTo ? $replyTo : $this->getHeader('From')); } + /** + * Returns the Snippet from the email + * + * @return string + */ + public function getSnippet() + { + + + return $this->snippet; + } + /** * Returns array of name and email of each recipient * @@ -407,7 +425,6 @@ public function getPlainTextBody($raw = false) public function getBody($type = 'text/plain') { $parts = $this->getAllParts($this->parts); - try { if (!$parts->isEmpty()) { foreach ($parts as $part) {