/** * Get email body * * @return EmailBody */ public function getBody() { if ($this->body === null) { $this->body = new EmailBody(); $body = $this->message->getBody(); try { $this->body->setContent($body->getContent(Body::FORMAT_HTML)->getDecodedContent()); $this->body->setBodyIsText(false); } catch (InvalidBodyFormatException $ex) { $this->body->setContent($body->getContent(Body::FORMAT_TEXT)->getDecodedContent()); $this->body->setBodyIsText(true); } } return $this->body; }
/** * Get email body * * @return EmailBody */ public function getBody() { if ($this->body === null) { $this->body = new EmailBody(); $body = $this->message->getBody(); $contentType = $this->message->getPriorContentType(); if ($contentType && strtolower($contentType->getType()) === 'text/html') { $this->body->setContent($body->getContent(Body::FORMAT_HTML)->getDecodedContent()); $this->body->setBodyIsText(false); } else { $this->body->setContent($body->getContent(Body::FORMAT_TEXT)->getDecodedContent()); $this->body->setBodyIsText(true); } } return $this->body; }