• Модуль: mail
  • Путь к файлу: ~/bitrix/modules/mail/classes/general/mail.php
  • Класс: CMailAttachment
  • Вызов: CMailAttachment::getContents
static function getContents($attachment)
{
	if (!is_array($attachment))
	{
		if ($res = CMailAttachment::getByID($attachment))
			$attachment = $res->fetch();
	}

	if (is_array($attachment))
	{
		if (!empty($attachment['FILE_DATA']))
			return $attachment['FILE_DATA'];

		if ($attachment['FILE_ID'] > 0)
		{
			if ($file = CFile::makeFileArray($attachment['FILE_ID']))
			{
				return (!empty($file['tmp_name'])
					&& BitrixMainIOFile::isFileExists($file['tmp_name']))
						? BitrixMainIOFile::getFileContents($file['tmp_name'])
						: false;
			}
		}
	}

	return false;
}