function sendMail($sid, $to, $cc, $bcc, $sender, $subject, $message, $attach)
 {
     $this->initAuth($sid);
     $this->initIlias();
     if (!$this->__checkSession($sid)) {
         return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
     }
     global $ilLog;
     include_once 'Services/Mail/classes/class.ilMimeMail.php';
     $mmail = new ilMimeMail();
     $mmail->autoCheck(false);
     $mmail->From($sender);
     $mmail->To(explode(',', $to));
     $mmail->Subject($subject);
     $mmail->Body($message);
     if ($cc) {
         $mmail->Cc(explode(',', $cc));
     }
     if ($bcc) {
         $mmail->Bcc(explode(',', $bcc));
     }
     if ($attach) {
         // mjansen: switched separator from "," to "#:#" because of mantis bug #6039
         // for backward compatibility we have to check if the substring "#:#" exists as leading separator
         // otherwise we should use ";"
         if (strpos($attach, '#:#') === 0) {
             $attach = substr($attach, strlen('#:#'));
             $attachments = explode('#:#', $attach);
         } else {
             $attachments = explode(',', $attach);
         }
         foreach ($attachments as $attachment) {
             $mmail->Attach($attachment);
         }
     }
     $mmail->Send();
     $ilLog->write('SOAP: sendMail(): ' . $to . ', ' . $cc . ', ' . $bcc);
     return true;
 }
 /**
  * send mime mail using class.ilMimeMail.php
  * All external mails are send to SOAP::sendMail starting a kind of background process
  * @param string of recipients
  * @param string of recipients
  * @param string of recipients
  * @param string subject
  * @param string message
  * @param array attachments
  * @param bool prevent soap
  * @access	public
  * @return	array of saved data
  */
 function sendMimeMail($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject, $a_m_message, $a_attachments, $a_no_soap = false)
 {
     include_once "Services/Mail/classes/class.ilMimeMail.php";
     #var_dump("<pre>",$a_rcp_to,$a_rcp_cc,$a_rcp_bcc,$a_m_subject,$a_m_message,$a_attachments,"<pre>");
     #$inst_name = $this->ilias->getSetting("inst_name") ? $this->ilias->getSetting("inst_name") : "ILIAS 4";
     #$a_m_subject = "[".$inst_name."] ".$a_m_subject;
     $a_m_subject = self::getSubjectPrefix() . ' ' . $a_m_subject;
     $sender = $this->getMimeMailSender();
     // #10854
     if ($this->isSOAPEnabled() && !$a_no_soap) {
         // Send per soap
         include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
         $soap_client = new ilSoapClient();
         $soap_client->setResponseTimeout(1);
         $soap_client->enableWSDL(true);
         $soap_client->init();
         $attachments = array();
         $a_attachments = $a_attachments ? $a_attachments : array();
         foreach ($a_attachments as $attachment) {
             $attachments[] = $this->mfile->getAbsolutePath($attachment);
         }
         // mjansen: switched separator from "," to "#:#" because of mantis bug #6039
         $attachments = implode('#:#', $attachments);
         // mjansen: use "#:#" as leading delimiter
         if (strlen($attachments)) {
             $attachments = "#:#" . $attachments;
         }
         $soap_client->call('sendMail', array($_COOKIE['PHPSESSID'] . '::' . $_COOKIE['ilClientId'], $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $sender, $a_m_subject, $a_m_message, $attachments));
         return true;
     } else {
         // send direct
         include_once "Services/Mail/classes/class.ilMimeMail.php";
         $mmail = new ilMimeMail();
         $mmail->autoCheck(false);
         $mmail->From($sender);
         $mmail->To($a_rcp_to);
         // Add installation name to subject
         $mmail->Subject($a_m_subject);
         $mmail->Body($a_m_message);
         if ($a_rcp_cc) {
             $mmail->Cc($a_rcp_cc);
         }
         if ($a_rcp_bcc) {
             $mmail->Bcc($a_rcp_bcc);
         }
         if (is_array($a_attachments)) {
             foreach ($a_attachments as $attachment) {
                 $mmail->Attach($this->mfile->getAbsolutePath($attachment));
             }
         }
         $mmail->Send();
     }
 }