/** * Creates an email. */ private function create() { $uniqueId = md5(uniqid((string) time())); $hostname = $this->clearHeaderValue($this->getHostname()); // Unique email Id $this->result->messageId = $uniqueId . '@' . $hostname; // Sending time $this->result->datetime = \Jyxo\Time\Time::now(); // Parts boundaries $this->boundary = [1 => '====b1' . $uniqueId . '====' . $hostname . '====', 2 => '====b2' . $uniqueId . '====' . $hostname . '====']; // Determine the message type if (!empty($this->email->attachments)) { // Are there any attachments? if (!empty($this->email->body->alternative)) { // There is an alternative content $this->type = self::TYPE_ALTERNATIVE_ATTACHMENTS; } else { // No alternative content $this->type = self::TYPE_ATTACHMENTS; } } else { // No attachments if (!empty($this->email->body->alternative)) { // There is an alternative content $this->type = self::TYPE_ALTERNATIVE; } else { // No alternative content $this->type = self::TYPE_SIMPLE; } } // Creates header and body $this->createHeader(); $this->createBody(); }