/**
* @return void
*/
public function ensureValidity() { $this->
ensureBodyValid();
if ('1' ===
$this->
getHeaders()->
getHeaderBody('X-Unsent'
)) { throw new LogicException('Cannot send messages marked as "draft".'
);
} parent::
ensureValidity();
} private function ensureBodyValid(): void
{ if (null ===
$this->text && null ===
$this->html && !
$this->attachments
) { throw new LogicException('A message must have a text or an HTML part or attachments.'
);
} } /**
* Generates an AbstractPart based on the raw body of a message.
*
* The most "complex" part generated by this method is when there is text and HTML bodies
* with related images for the HTML part and some attachments:
*
* multipart/mixed
* |
* |------------> multipart/related
* | |
* | |------------> multipart/alternative
* | | |
* | | ------------> text/plain (with content)
* | | |
* | | ------------> text/html (with content)
* | |
* | ------------> image/png (with content)
* |
* ------------> application/pdf (with content)
*/