- Модуль: mail
- Путь к файлу: ~/bitrix/modules/mail/lib/helper/mailbox/imap.php
- Класс: BitrixMailHelperMailboxImap
- Вызов: Imap::uploadMessage
public function uploadMessage(MainMailMail $message, array &$excerpt = null)
{
$dirPath = $this->getDirsHelper()->getOutcomePath() ?: 'INBOX';
$data = $this->client->select($dirPath, $error);
if (false === $data)
{
$this->errors = new MainErrorCollection($this->client->getErrors()->toArray());
return false;
}
if (!empty($excerpt['__unique_headers']))
{
if ($this->client->searchByHeader(false, $dirPath, $excerpt['__unique_headers'], $error))
{
return false;
}
}
if (!empty($excerpt['ID']))
{
class_exists('BitrixMailHelper');
MailDummyMail::overwriteMessageHeaders(
$message,
array(
'X-Bitrix-Mail-Message-UID' => $excerpt['ID'],
)
);
}
$result = $this->client->append(
$dirPath,
array('Seen'),
new DateTime,
sprintf(
'%1$s%3$s%3$s%2$s',
$message->getHeaders(),
$message->getBody(),
$message->getMailEol()
),
$error
);
if (false === $result)
{
$this->errors = new MainErrorCollection($this->client->getErrors()->toArray());
return false;
}
$this->syncDir($dirPath);
return $result;
}