function sendSystemMail($data) { global $osC_Session; $mailer = new osC_Mail(); $mailer->setFrom($this->getAccountName(), $this->getAccountEmail()); foreach ($data['to'] as $to) { $mailer->addTo($to['name'], $to['email']); } if ($data['cc'] != null) { foreach ($data['cc'] as $cc) { $mailer->AddCC($cc['name'], $cc['email']); } } if ($data['bcc'] != null) { foreach ($data['bcc'] as $bcc) { $mailer->AddBCC($bcc['name'], $bcc['email']); } } $mailer->setSubject($data['subject']); if ($data['content_type'] == 'html') { $mailer->setBodyHTML($data['body']); } elseif ($data['content_type'] == 'text') { $mailer->setBodyPlain($data['body']); } $path = DIR_FS_CACHE_ADMIN . 'emails/attachments/' . $osC_Session->getID(); $directory = new osC_DirectoryListing($path); if ($directory->getSize() > 0) { foreach ($directory->getFiles() as $file) { $mailer->AddAttachment($path . '/' . $file['name']); } } if ($mailer->Send()) { $data['messages_flag'] = EMAIL_MESSAGE_SENT_ITEM; return $this->saveSentMessage($data); } return false; }