4require_once
'Services/User/classes/class.ilObjUser.php';
5require_once
'Services/Mail/exceptions/class.ilMailException.php';
134 require_once
'Services/Mail/classes/class.ilFileDataMail.php';
135 require_once
'Services/Mail/classes/class.ilMailOptions.php';
148 $this->lng =
$DIC->language();
149 $this->db =
$DIC->database();
151 $this->lng->loadLanguageModule(
'mail');
153 $this->table_mail =
'mail';
154 $this->table_mail_saved =
'mail_saved';
156 $this->user_id = $a_user_id;
170 return $this->user_id == ANONYMOUS_USER_ID;
183 if (isset($this->properties[
$name])) {
184 return $this->properties[
$name];
187 if (
$name ==
'mlists') {
188 if (is_object(
$DIC->user())) {
189 require_once
'Services/Contact/classes/class.ilMailingLists.php';
191 return $this->properties[
$name];
204 foreach ($recipients as $rcp) {
205 if (substr($rcp->getMailbox(), 0, 1) !=
'#') {
206 if (trim($rcp->getMailbox()) == trim($a_recipient) || trim($rcp->getMailbox() .
'@' . $rcp->getHost()) == trim($a_recipient)) {
209 } elseif (substr($rcp->getMailbox(), 0, 7) ==
'#il_ml_') {
210 if (trim($rcp->getMailbox() .
'@' . $rcp->getHost()) == trim($a_recipient)) {
214 if (trim($rcp->getMailbox() .
'@' . $rcp->getHost()) == trim($a_recipient)) {
230 $this->soap_enabled = (bool) $a_status;
240 if (!extension_loaded(
'curl') || !
$DIC->settings()->get(
'soap_user_administration')) {
256 $this->save_in_sentbox = (bool) $a_save_in_sentbox;
272 require_once
'Services/Mail/classes/class.ilMailGlobalServices.php';
294 $a_recipients = trim($a_recipients);
295 if (!strlen($a_recipients)) {
296 return $this->lng->txt(
'not_available');
301 $recipients = array_filter(array_map(
'trim', explode(
',', $a_recipients)));
302 foreach ($recipients as $recipient) {
306 if ($pp ==
'y' || ($pp ==
'g' && !
$DIC->user()->isAnonymous())) {
308 $names[] = $user->getFullname() .
' [' . $recipient .
']';
316 return implode(
', ',
$names);
325 $this->db->setLimit(1);
327 $res = $this->db->queryF(
329 SELECT b.* FROM {$this->table_mail} a
330 INNER JOIN {$this->table_mail} b ON b.folder_id = a.folder_id
331 AND b.user_id = a.user_id AND b.send_time > a.send_time
332 WHERE a.user_id = %s AND a.mail_id = %s ORDER BY b.send_time ASC",
333 array(
'integer',
'integer'),
334 array($this->user_id, $a_mail_id)
348 $this->db->setLimit(1);
350 $res = $this->db->queryF(
352 SELECT b.* FROM {$this->table_mail} a
353 INNER JOIN {$this->table_mail} b ON b.folder_id = a.folder_id
354 AND b.user_id = a.user_id AND b.send_time < a.send_time
355 WHERE a.user_id = %s AND a.mail_id = %s ORDER BY b.send_time DESC",
356 array(
'integer',
'integer'),
357 array($this->user_id, $a_mail_id)
375 SELECT sender_id, m_subject, mail_id, m_status, send_time FROM {$this->table_mail}
376 LEFT JOIN object_data ON obj_id = sender_id
377 WHERE user_id = %s AND folder_id = %s
378 AND ((sender_id > 0 AND sender_id IS NOT NULL AND obj_id IS NOT NULL) OR (sender_id = 0 OR sender_id IS NULL)) ";
380 if (isset($filter[
'status']) && strlen($filter[
'status']) > 0) {
381 $query .=
' AND m_status = ' . $this->db->quote($filter[
'status'],
'text');
384 if (isset($filter[
'type']) && strlen($filter[
'type']) > 0) {
385 $query .=
' AND ' . $this->db->like(
'm_type',
'text',
'%%:"' . $filter[
'type'] .
'"%%',
false);
388 $query .=
" ORDER BY send_time DESC";
390 $res = $this->db->queryF(
392 array(
'integer',
'integer'),
393 array($this->user_id, $a_folder_id)
396 while (
$row = $this->db->fetchAssoc(
$res)) {
409 $res = $this->db->queryF(
411 SELECT COUNT(*) FROM {$this->table_mail}
412 WHERE user_id = %s AND folder_id = %s",
413 array(
'integer',
'integer'),
414 array($this->user_id, $a_folder_id)
417 return $this->db->numRows(
$res);
444 $res = $this->db->queryF(
446 SELECT * FROM {$this->table_mail}
447 WHERE user_id = %s AND mail_id = %s",
448 array(
'integer',
'integer'),
449 array($this->user_id, $a_mail_id)
464 $data_types = array();
466 $query =
"UPDATE {$this->table_mail} SET m_status = %s WHERE user_id = %s ";
467 array_push($data_types,
'text',
'integer');
468 array_push(
$data,
'read', $this->user_id);
470 if (count($a_mail_ids) > 0) {
471 $in =
'mail_id IN (';
473 foreach ($a_mail_ids as $a_mail_id) {
474 array_push(
$data, $a_mail_id);
475 array_push($data_types,
'integer');
488 $this->db->manipulateF(
$query, $data_types,
$data);
500 $data_types = array();
502 $query =
"UPDATE {$this->table_mail} SET m_status = %s WHERE user_id = %s ";
503 array_push($data_types,
'text',
'integer');
504 array_push(
$data,
'unread', $this->user_id);
506 if (count($a_mail_ids) > 0) {
507 $in =
'mail_id IN (';
509 foreach ($a_mail_ids as $a_mail_id) {
510 array_push(
$data, $a_mail_id);
511 array_push($data_types,
'integer');
524 $this->db->manipulateF(
$query, $data_types,
$data);
537 $data_types = array();
539 $query =
"UPDATE {$this->table_mail} SET folder_id = %s WHERE user_id = %s ";
540 array_push($data_types,
'text',
'integer');
541 array_push(
$data, $a_folder_id, $this->user_id);
543 if (count($a_mail_ids) > 0) {
544 $in =
'mail_id IN (';
546 foreach ($a_mail_ids as $a_mail_id) {
547 array_push(
$data, $a_mail_id);
548 array_push($data_types,
'integer');
561 $this->db->manipulateF(
$query, $data_types,
$data);
572 foreach ($a_mail_ids as
$id) {
573 $this->db->manipulateF(
575 DELETE FROM {$this->table_mail}
576 WHERE user_id = %s AND mail_id = %s ",
577 array(
'integer',
'integer'),
578 array($this->user_id,
$id)
580 $this->mfile->deassignAttachmentFromDirectory(
$id);
592 if (!is_array($a_row) || empty($a_row)) {
596 $a_row[
'attachments'] = unserialize(stripslashes($a_row[
'attachments']));
597 $a_row[
'm_type'] = unserialize(stripslashes($a_row[
'm_type']));
598 $a_row[
'tpl_ctx_params'] = (array) (@json_decode($a_row[
'tpl_ctx_params'],
true));
610 $next_id = $this->db->nextId($this->table_mail);
611 $this->db->insert($this->table_mail, array(
612 'mail_id' => array(
'integer', $next_id),
613 'user_id' => array(
'integer', $usrId),
614 'folder_id' => array(
'integer', $folderId),
615 'sender_id' => array(
'integer', $usrId)
632 $a_use_placeholders = 0,
633 $a_tpl_context_id =
null,
634 $a_tpl_context_params = array()
639 'folder_id' => array(
'integer', $a_folder_id),
640 'attachments' => array(
'clob', serialize($a_attachments)),
641 'send_time' => array(
'timestamp',
date(
'Y-m-d H:i:s', time())),
642 'rcp_to' => array(
'clob', $a_rcp_to),
643 'rcp_cc' => array(
'clob', $a_rcp_cc),
644 'rcp_bcc' => array(
'clob', $a_rcp_bcc),
645 'm_status' => array(
'text',
'read'),
646 'm_type' => array(
'text', serialize($a_m_type)),
647 'm_email' => array(
'integer', $a_m_email),
648 'm_subject' => array(
'text', $a_m_subject),
649 'm_message' => array(
'clob', $a_m_message),
650 'use_placeholders' => array(
'integer', $a_use_placeholders),
651 'tpl_ctx_id' => array(
'text', $a_tpl_context_id),
652 'tpl_ctx_params' => array(
'blob', @json_encode((array) $a_tpl_context_params))
655 'mail_id' => array(
'integer', $a_draft_id)
695 $a_use_placeholders = 0,
696 $a_tpl_context_id =
null,
697 $a_tpl_context_params = array()
701 if ($a_use_placeholders) {
715 if (!$a_attachments) {
716 $a_attachments =
null;
743 $next_id = $this->db->nextId($this->table_mail);
744 $this->db->insert($this->table_mail, array(
745 'mail_id' => array(
'integer', $next_id),
746 'user_id' => array(
'integer', $a_user_id),
747 'folder_id' => array(
'integer', $a_folder_id),
748 'sender_id' => array(
'integer', $a_sender_id),
749 'attachments' => array(
'clob', serialize($a_attachments)),
750 'send_time' => array(
'timestamp',
date(
'Y-m-d H:i:s', time())),
751 'rcp_to' => array(
'clob', $a_rcp_to),
752 'rcp_cc' => array(
'clob', $a_rcp_cc),
753 'rcp_bcc' => array(
'clob', $a_rcp_bcc),
754 'm_status' => array(
'text', $a_status),
755 'm_type' => array(
'text', serialize($a_m_type)),
756 'm_email' => array(
'integer', $a_m_email),
757 'm_subject' => array(
'text', $a_m_subject),
758 'm_message' => array(
'clob', $a_m_message),
759 'tpl_ctx_id' => array(
'text', $a_tpl_context_id),
760 'tpl_ctx_params' => array(
'blob', @json_encode((array) $a_tpl_context_params))
775 include_once
'Services/Mail/classes/class.ilMailFormCall.php';
778 require_once
'Services/Mail/classes/class.ilMailTemplateService.php';
781 require_once
'Services/Mail/classes/class.ilMailTemplateGenericContext.php';
787 require_once
'Services/Mail/classes/class.ilMailTemplatePlaceholderResolver.php';
790 }
catch (Exception $e) {
791 require_once
'./Services/Logging/classes/public/class.ilLoggerFactory.php';
811 protected function distributeMail($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_subject, $a_message, $a_attachments, $sent_mail_id,
$a_type, $a_action, $a_use_placeholders = 0)
813 require_once
'Services/Mail/classes/class.ilMailbox.php';
814 require_once
'Services/User/classes/class.ilObjUser.php';
817 if (!$a_use_placeholders) {
818 $rcp_ids = $this->
getUserIds(array($a_rcp_to, $a_rcp_cc, $a_rcp_bcc));
821 "Parsed TO/CC/BCC user ids from given recipients: %s",
822 implode(
', ', $rcp_ids)
827 foreach ($rcp_ids as
$id) {
831 $user_is_active = $tmp_user->getActive();
832 $user_can_read_internal_mails = !$tmp_user->hasToAcceptTermsOfService() && $tmp_user->checkTimeLimit();
834 if (in_array(
'system',
$a_type) && !$user_can_read_internal_mails) {
836 "Message is marked as 'system', skipped recipient with id %s (Accepted User Agreement:%s|Expired Account:%s)",
838 var_export(!$tmp_user->hasToAcceptTermsOfService(), 1),
839 var_export(!$tmp_user->checkTimeLimit(), 1)
844 if ($user_is_active) {
845 if (!$user_can_read_internal_mails
849 $as_email = array_unique(array_merge($newEmailAddresses, $as_email));
853 "Recipient with id %s will only receive external emails sent to: %s",
855 implode(
', ', $newEmailAddresses)
860 "Recipient with id %s will additionally receive external emails sent to: %s",
862 implode(
', ', $newEmailAddresses)
868 $mbox->setUserId(
$id);
869 $inbox_id = $mbox->getInboxFolder();
887 if ($a_attachments) {
888 $this->mfile->assignAttachmentsToDirectory($mail_id, $sent_mail_id);
895 $as_email = array_values(array_unique($as_email));
896 if (count($as_email) == 1) {
897 $to[] = $as_email[0];
899 foreach ($as_email as
$email) {
904 if (count($to) > 0 || count($bcc) > 0) {
905 $this->sendMimeMail(implode(
',', $to),
'', implode(
',', $bcc), $a_subject, $this->
formatLinebreakMessage($a_message), $a_attachments);
908 $rcp_ids_replace = $this->
getUserIds(array($a_rcp_to));
909 $rcp_ids_no_replace = $this->
getUserIds(array($a_rcp_cc, $a_rcp_bcc));
912 "Parsed TO user ids from given recipients for serial letter notification: %s",
913 implode(
', ', $rcp_ids_replace)
916 "Parsed CC/BCC user ids from given recipients for serial letter notification: %s",
917 implode(
', ', $rcp_ids_no_replace)
921 $id_to_message_map = array();
923 foreach ($rcp_ids_replace as
$id) {
927 $user_is_active = $tmp_user->getActive();
928 $user_can_read_internal_mails = !$tmp_user->hasToAcceptTermsOfService() && $tmp_user->checkTimeLimit();
930 if (in_array(
'system',
$a_type) && !$user_can_read_internal_mails) {
932 "Message is marked as 'system', skipped recipient with id %s (Accepted User Agreement:%s|Expired Account:%s)",
934 var_export(!$tmp_user->hasToAcceptTermsOfService(), 1),
935 var_export(!$tmp_user->checkTimeLimit(), 1)
942 if ($user_is_active) {
943 if (!$user_can_read_internal_mails
950 "Recipient with id %s will only receive external emails sent to: %s",
952 implode(
', ', $as_email[$tmp_user->getId()])
957 "Recipient with id %s will additionally receive external emails sent to: %s",
959 implode(
', ', $as_email[$tmp_user->getId()])
965 $mbox->setUserId(
$id);
966 $inbox_id = $mbox->getInboxFolder();
979 $id_to_message_map[
$id],
984 if ($a_attachments) {
985 $this->mfile->assignAttachmentsToDirectory($mail_id, $sent_mail_id);
989 if (count($as_email)) {
990 foreach ($as_email as
$id => $emails) {
991 if (0 == count($emails)) {
995 $toEmailAddresses = implode(
',', $emails);
996 $this->sendMimeMail($toEmailAddresses,
'',
'', $a_subject, $this->
formatLinebreakMessage($id_to_message_map[
$id]), $a_attachments);
1000 $as_email = array();
1004 foreach ($rcp_ids_no_replace as
$id) {
1008 $user_is_active = $tmp_user->getActive();
1009 $user_can_read_internal_mails = !$tmp_user->hasToAcceptTermsOfService() && $tmp_user->checkTimeLimit();
1011 if ($user_is_active) {
1012 if (in_array(
'system',
$a_type) && !$user_can_read_internal_mails) {
1014 "Message is marked as 'system', skipped recipient with id %s (Accepted User Agreement:%s|Expired Account:%s)",
1016 var_export(!$tmp_user->hasToAcceptTermsOfService(), 1),
1017 var_export(!$tmp_user->checkTimeLimit(), 1)
1023 if (!$user_can_read_internal_mails
1027 $as_email = array_unique(array_merge($newEmailAddresses, $as_email));
1031 "Recipient with id %s will only receive external emails sent to: %s",
1033 implode(
', ', $newEmailAddresses)
1038 "Recipient with id %s will additionally receive external emails sent to: %s",
1040 implode(
', ', $newEmailAddresses)
1046 $mbox->setUserId(
$id);
1047 $inbox_id = $mbox->getInboxFolder();
1060 $cc_and_bcc_message,
1065 if ($a_attachments) {
1066 $this->mfile->assignAttachmentsToDirectory($mail_id, $sent_mail_id);
1070 if (count($as_email)) {
1071 $this->sendMimeMail(
'',
'', implode(
',', $as_email), $a_subject, $this->
formatLinebreakMessage($cc_and_bcc_message), $a_attachments);
1086 $a_recipients = implode(
',', array_filter(array_map(
'trim', $a_recipients)));
1089 foreach ($recipients as $recipient) {
1090 $address_type = $this->mailAddressTypeFactory->getByPrefix($recipient);
1091 $usr_ids = array_merge($usr_ids, $address_type->resolve());
1094 return array_unique($usr_ids);
1104 protected function checkMail($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject)
1108 $a_m_subject => array(
'mail_add_subject'),
1109 $a_rcp_to => array(
'mail_add_recipient')
1110 ) as $string => $e) {
1111 if (strlen($string) === 0) {
1132 foreach ($recipients as $recipient) {
1133 $address_type = $this->mailAddressTypeFactory->getByPrefix($recipient);
1134 if (!$address_type->validate($this->user_id)) {
1139 $colon_pos = strpos($e->getMessage(),
':');
1140 throw new ilMailException(($colon_pos ===
false) ? $e->getMessage() : substr($e->getMessage(), $colon_pos + 2));
1173 $a_use_placeholders,
1174 $a_tpl_context_id =
null,
1175 $a_tpl_ctx_params = array()
1177 if (!$a_attachments) {
1178 $a_attachments =
null;
1195 if (!$a_m_message) {
1196 $a_m_message =
null;
1198 if (!$a_use_placeholders) {
1199 $a_use_placeholders =
'0';
1203 $this->table_mail_saved,
1205 'user_id' => array(
'integer', $this->user_id)
1208 'attachments' => array(
'clob', serialize($a_attachments)),
1209 'rcp_to' => array(
'clob', $a_rcp_to),
1210 'rcp_cc' => array(
'clob', $a_rcp_cc),
1211 'rcp_bcc' => array(
'clob', $a_rcp_bcc),
1212 'm_type' => array(
'text', serialize($a_m_type)),
1213 'm_email' => array(
'integer', $a_m_email),
1214 'm_subject' => array(
'text', $a_m_subject),
1215 'm_message' => array(
'clob', $a_m_message),
1216 'use_placeholders' => array(
'integer', $a_use_placeholders),
1217 'tpl_ctx_id' => array(
'text', $a_tpl_context_id),
1218 'tpl_ctx_params' => array(
'blob', json_encode((array) $a_tpl_ctx_params))
1232 $res = $this->db->queryF(
1233 "SELECT * FROM {$this->table_mail_saved} WHERE user_id = %s",
1235 array($this->user_id)
1255 public function sendMail($a_rcp_to, $a_rcp_cc, $a_rcp_bc, $a_m_subject, $a_m_message, $a_attachment,
$a_type, $a_use_placeholders = 0)
1260 "New mail system task:" .
1261 " To: " . $a_rcp_to .
1262 " | CC: " . $a_rcp_cc .
1263 " | BCC: " . $a_rcp_bc .
1264 " | Subject: " . $a_m_subject
1267 $this->mail_to_global_roles =
true;
1269 $this->mail_to_global_roles =
$DIC->rbac()->system()->checkAccessOfUser($this->user_id,
'mail_to_global_roles', $this->mail_obj_ref_id);
1272 if (in_array(
'system',
$a_type)) {
1276 if ($a_attachment && !$this->mfile->checkFilesExist($a_attachment)) {
1277 return array(array(
'mail_attachment_file_not_exist', $a_attachment));
1290 $rcp_to = $a_rcp_to;
1291 $rcp_cc = $a_rcp_cc;
1292 $rcp_bc = $a_rcp_bc;
1298 !$DIC->rbac()->system()->checkAccessOfUser($this->user_id,
'smtp_mail', $this->mail_obj_ref_id)
1300 return array(array(
'mail_no_permissions_write_smtp'));
1307 $sent_id = $this->
saveInSentbox($a_attachment, $a_rcp_to, $a_rcp_cc, $a_rcp_bc,
$a_type, $a_m_subject, $a_m_message);
1309 if ($a_attachment) {
1310 $this->mfile->assignAttachmentsToDirectory($sent_id, $sent_id);
1311 $this->mfile->saveFiles($sent_id, $a_attachment);
1320 "Parsed external email addresses from given recipients:" .
1321 " To: " . $externalMailRecipientsTo .
1322 " | CC: " . $externalMailRecipientsCc .
1323 " | BCC: " . $externalMailRecipientsBcc .
1324 " | Subject: " . $a_m_subject
1327 $this->sendMimeMail(
1328 $externalMailRecipientsTo,
1329 $externalMailRecipientsCc,
1330 $externalMailRecipientsBcc,
1340 if (in_array(
'system',
$a_type) && !$this->
distributeMail($rcp_to, $rcp_cc, $rcp_bc, $a_m_subject, $a_m_message, $a_attachment, $sent_id,
$a_type,
'system', $a_use_placeholders)) {
1341 return array(array(
'mail_send_error'));
1344 if (in_array(
'normal',
$a_type) && !$this->
distributeMail($rcp_to, $rcp_cc, $rcp_bc, $a_m_subject, $a_m_message, $a_attachment, $sent_id,
$a_type,
'normal', $a_use_placeholders)) {
1345 return array(array(
'mail_send_error'));
1370 return array_merge(array(array(
'mail_following_rcp_not_valid')),
$errors);
1373 return array(array(
'mail_generic_rcp_error', $e->getMessage()));
1390 protected function saveInSentbox($a_attachment, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc,
$a_type, $a_m_subject, $a_m_message)
1392 require_once
'Services/Mail/classes/class.ilMailbox.php';
1395 $sent_folder_id = $mbox->getSentFolder();
1425 public function sendMimeMail($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject, $a_m_message, $a_attachments, $a_no_soap =
false)
1427 require_once
'Services/Mail/classes/class.ilMimeMail.php';
1433 require_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
1435 $soap_client->setResponseTimeout(5);
1436 $soap_client->enableWSDL(
true);
1437 $soap_client->init();
1439 $attachments = array();
1440 $a_attachments = $a_attachments ? $a_attachments : array();
1441 foreach ($a_attachments as $attachment) {
1442 $attachments[] = $this->mfile->getAbsolutePath($attachment);
1446 $attachments = implode(
'#:#', $attachments);
1448 if (strlen($attachments)) {
1449 $attachments =
"#:#" . $attachments;
1452 $soap_client->call(
'sendMail', array(
1453 session_id() .
'::' .
$_COOKIE[
'ilClientId'],
1464 $senderFactory =
$GLOBALS[
"DIC"][
"mail.mime.sender.factory"];
1467 $mmail->From($senderFactory->getSenderByUsrId($this->user_id));
1468 $mmail->To($a_rcp_to);
1469 $mmail->Subject($a_m_subject);
1470 $mmail->Body($a_m_message);
1473 $mmail->Cc($a_rcp_cc);
1477 $mmail->Bcc($a_rcp_bcc);
1480 if (is_array($a_attachments)) {
1481 foreach ($a_attachments as $attachment) {
1482 $mmail->Attach($this->mfile->getAbsolutePath($attachment),
'',
'inline', $attachment);
1497 $this->table_mail_saved,
1499 'attachments' => array(
'clob', serialize($a_attachments))
1502 'user_id' => array(
'integer', $this->user_id)
1517 if (strlen($addresses) > 0) {
1519 "Started parsing of recipient string: %s",
1524 $parser = $this->mailAddressParserFactory->getParser($addresses);
1525 $parsedAddresses =
$parser->parse();
1527 if (strlen($addresses) > 0) {
1529 "Parsed addresses: %s",
1532 }, $parsedAddresses))
1536 return $parsedAddresses;
1549 foreach ($recipients as $recipient) {
1550 if ($a_only_email) {
1559 if ($recipient->getHost() != self::ILIAS_HOST && substr($recipient->getMailbox(), 0, 1) !=
'#') {
1594 foreach ($recipients as $recipient) {
1595 if (substr($recipient->getMailbox(), 0, 1) !=
'#' && $recipient->getHost() != self::ILIAS_HOST) {
1601 $rcp[] = $recipient->getMailbox() .
'@' . $recipient->getHost();
1605 return implode(
',', $rcp);
1618 require_once
'Services/Language/classes/class.ilLanguageFactory.php';
1622 $lang->loadLanguageModule(
'mail');
1625 $lang->txt(
'mail_auto_generated_info'),
1626 $DIC->settings()->get(
'inst_name',
'ILIAS 5'),
1635 public static function _getIliasMailerName()
1638 $senderFactory =
$GLOBALS[
"DIC"][
"mail.mime.sender.factory"];
1640 return $senderFactory->system()->getFromName();
1650 if (
null === $a_flag) {
1665 $signature =
$DIC->settings()->get(
'mail_system_sys_signature');
1668 $clientdirs = glob(ILIAS_WEB_DIR .
'/*', GLOB_ONLYDIR);
1669 if (is_array($clientdirs) && count($clientdirs) > 1) {
1670 $clientUrl .=
'/login.php?client_id=' . CLIENT_ID;
1673 $signature = str_ireplace(
'[CLIENT_NAME]',
$DIC[
'ilClientIniFile']->
readVariable(
'client',
'name'), $signature);
1674 $signature = str_ireplace(
'[CLIENT_DESC]',
$DIC[
'ilClientIniFile']->
readVariable(
'client',
'description'), $signature);
1675 $signature = str_ireplace(
'[CLIENT_URL]', $clientUrl, $signature);
1677 if (!preg_match(
'/^[\n\r]+/', $signature)) {
1678 $signature =
"\n" . $signature;
1692 $subjectPrefix =
$DIC->settings()->get(
'mail_subject_prefix');
1693 if (
false === $subjectPrefix) {
1697 return $subjectPrefix;
1710 $lang->loadLanguageModule(
'mail');
1713 $gender = $gender ? $gender :
'n';
1716 if (!strlen(
$name[
'firstname'])) {
1717 return $lang->txt(
'mail_salutation_anonymous') .
',';
1721 $lang->txt(
'mail_salutation_' . $gender) .
' ' .
1722 (
$name[
'title'] ?
$name[
'title'] .
' ' :
'') .
1723 (
$name[
'firstname'] ?
$name[
'firstname'] .
' ' :
'') .
1724 $name[
'lastname'] .
',';
1733 if (isset(self::$userInstances[$a_usr_id])) {
1734 return self::$userInstances[$a_usr_id];
1737 self::$userInstances[$a_usr_id] =
new ilObjUser($a_usr_id);
1738 return self::$userInstances[$a_usr_id];
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
if(php_sapi_name() !='cli') $in
An exception for terminatinating execution or to throw for unit testing.
readVariable($a_group, $a_var_name)
reads a single variable from a group @access public
static getType()
Get context type.
Base class for ILIAS Exception handling.
This class handles all operations on files (attachments) in directory ilias_data/mail.
static _getLanguage($a_lang_key='')
Get langauge object.
static getLogger($a_component_id)
Get component logger.
Class ilMailAddressTypeFactory.
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable.
Class ilMailOptions this class handles user mails.
static getExternalEmailsByUser(ilObjUser $user, ilMailOptions $mail_options=null)
Class ilMailRfc822AddressParserFactory.
Class ilMailTemplaceProcessor.
static getTemplateContextById($a_id)
This class handles base functions for mail handling.
static getCachedUserInstance($a_usr_id)
static _getAutoGeneratedMessageString(ilLanguage $lang=null)
Get auto generated info string.
formatNamesForOutput($a_recipients)
Prepends the fullname of each ILIAS login name (if user has a public profile) found in the passed str...
$mailAddressParserFactory
markUnread(array $a_mail_ids)
getCountRecipient($a_recipients, $a_only_email=true)
deleteMails(array $a_mail_ids)
distributeMail($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_subject, $a_message, $a_attachments, $sent_mail_id, $a_type, $a_action, $a_use_placeholders=0)
getEmailRecipients($a_recipients)
appendInstallationSignature($a_flag=null)
Setter/Getter for appending the installation signarue.
checkMail($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject)
setSaveInSentbox($a_save_in_sentbox)
getCountRecipients($a_to, $a_cc, $a_bcc, $a_only_email=true)
checkRecipients($a_recipients)
Check if recipients are valid.
markRead(array $a_mail_ids)
enableSOAP($a_status)
Define if external mails should be sent using SOAP client or not.
replacePlaceholders($a_message, $a_user_id=0, $replace_empty=true)
moveMailsToFolder(array $a_mail_ids, $a_folder_id)
updateDraft( $a_folder_id, $a_attachments, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_type, $a_m_email, $a_m_subject, $a_m_message, $a_draft_id=0, $a_use_placeholders=0, $a_tpl_context_id=null, $a_tpl_context_params=array())
const MAIL_SUBJECT_PREFIX
countMailsOfFolder($a_folder_id)
existsRecipient($a_recipient, $a_existing_recipients)
sendInternalMail( $a_folder_id, $a_sender_id, $a_attachments, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_status, $a_m_type, $a_m_email, $a_m_subject, $a_m_message, $a_user_id=0, $a_use_placeholders=0, $a_tpl_context_id=null, $a_tpl_context_params=array())
save mail in folder @access private
getMailsOfFolder($a_folder_id, $filter=array())
saveAttachments($a_attachments)
static getSubjectPrefix()
Get text that will be prepended to auto generated mails.
getNewDraftId($usrId, $folderId)
static _getInstallationSignature()
saveInSentbox($a_attachment, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_type, $a_m_subject, $a_m_message)
Stores a message in the sent bod of the current user.
getPreviousMail($a_mail_id)
deleteMailsOfFolder($a_folder_id)
$appendInstallationSignature
static getSalutation($a_usr_id, ilLanguage $a_language=null)
parseAddresses($addresses)
Explode recipient string, allowed separators are ',' ';' ' ' Returns an array with recipient ilMailAd...
getMailObjectReferenceId()
__construct( $a_user_id, ilMailAddressTypeFactory $mailAddressTypeFactory=null, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
validateRecipients($a_rcp_to, $a_rcp_cc, $a_rcp_bc)
sendMail($a_rcp_to, $a_rcp_cc, $a_rcp_bc, $a_m_subject, $a_m_message, $a_attachment, $a_type, $a_use_placeholders=0)
Should be used to send notifcations over the internal or external mail channel.
readMailObjectReferenceId()
Read and set the mail object ref id (administration node)
__get($name)
Magic interceptor method __get Used to include files / instantiate objects at runtime.
formatLinebreakMessage($a_message)
getUserIds(array $a_recipients)
savePostData( $a_user_id, $a_attachments, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_type, $a_m_email, $a_m_subject, $a_m_message, $a_use_placeholders, $a_tpl_context_id=null, $a_tpl_ctx_params=array())
save post data in table @access public
Mail Box class Base class for creating and handling mail boxes.
static _lookupPref($a_usr_id, $a_keyword)
static _lookupId($a_user_str)
Lookup id by login.
static _lookupGender($a_user_id)
Lookup gender.
static _lookupName($a_user_id)
lookup user name
if(!array_key_exists('StateId', $_REQUEST)) $id
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
foreach($_POST as $key=> $value) $res