111 int $mailAdminNodeRefId =
null
133 if ($mailFileData ===
null) {
136 if ($mailOptions ===
null) {
139 if ($mailBox ===
null) {
151 $this->user_id = (int) $a_user_id;
158 $this->mfile = $mailFileData;
159 $this->mail_options = $mailOptions;
160 $this->mailbox = $mailBox;
164 $this->mail_obj_ref_id = $mailAdminNodeRefId;
165 if (
null === $this->mail_obj_ref_id) {
169 $this->lng->loadLanguageModule(
'mail');
170 $this->table_mail =
'mail';
171 $this->table_mail_saved =
'mail_saved';
181 $clone = clone $this;
194 $clone = clone $this;
196 $clone->contextParameters = $parameters;
206 return $this->user_id == ANONYMOUS_USER_ID;
214 public function existsRecipient(
string $newRecipient,
string $existingRecipients) : bool
221 $diffedAddresses = $list->value();
223 return count($diffedAddresses) === 0;
231 $this->save_in_sentbox = (bool) $saveInSentbox;
268 $recipients = trim($recipients);
269 if (0 === strlen($recipients)) {
270 return $this->lng->txt(
'not_available');
275 $recipients = array_filter(array_map(
'trim', explode(
',', $recipients)));
276 foreach ($recipients as $recipient) {
280 if ($pp ===
'g' || ($pp ===
'y' && !
$DIC->user()->isAnonymous())) {
282 $names[] = $user->getFullname() .
' [' . $recipient .
']';
287 $names[] = $recipient;
290 return implode(
', ', $names);
299 $this->db->setLimit(1, 0);
302 "SELECT b.* FROM {$this->table_mail} a",
303 "INNER JOIN {$this->table_mail} b ON b.folder_id = a.folder_id",
304 'AND b.user_id = a.user_id AND b.send_time > a.send_time',
305 'WHERE a.user_id = %s AND a.mail_id = %s ORDER BY b.send_time ASC',
307 $res = $this->db->queryF(
309 [
'integer',
'integer'],
310 [$this->user_id, $mailId]
324 $this->db->setLimit(1, 0);
327 "SELECT b.* FROM {$this->table_mail} a",
328 "INNER JOIN {$this->table_mail} b ON b.folder_id = a.folder_id",
329 'AND b.user_id = a.user_id AND b.send_time < a.send_time',
330 'WHERE a.user_id = %s AND a.mail_id = %s ORDER BY b.send_time DESC',
332 $res = $this->db->queryF(
334 [
'integer',
'integer'],
335 [$this->user_id, $mailId]
353 "SELECT sender_id, m_subject, mail_id, m_status, send_time " .
354 "FROM {$this->table_mail} " .
355 "LEFT JOIN object_data ON obj_id = sender_id " .
356 "WHERE user_id = %s AND folder_id = %s " .
357 "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))";
359 if (isset($filter[
'status']) && strlen($filter[
'status']) > 0) {
360 $query .=
' AND m_status = ' . $this->db->quote($filter[
'status'],
'text');
363 $query .=
" ORDER BY send_time DESC";
365 $res = $this->db->queryF(
367 [
'integer',
'integer'],
368 [$this->user_id, $a_folder_id]
371 while ($row = $this->db->fetchAssoc(
$res)) {
375 return array_filter($mails);
384 $res = $this->db->queryF(
385 "SELECT COUNT(*) FROM {$this->table_mail} WHERE user_id = %s AND folder_id = %s",
386 [
'integer',
'integer'],
387 [$this->user_id, $folderId]
390 return $this->db->numRows(
$res);
410 $res = $this->db->queryF(
411 "SELECT * FROM {$this->table_mail} WHERE user_id = %s AND mail_id = %s",
412 [
'integer',
'integer'],
413 [$this->user_id, $mailId]
429 $query =
"UPDATE {$this->table_mail} SET m_status = %s WHERE user_id = %s ";
430 array_push($types,
'text',
'integer');
431 array_push($values,
'read', $this->user_id);
433 if (count($mailIds) > 0) {
434 $query .=
' AND ' . $this->db->in(
'mail_id', $mailIds,
false,
'integer');
437 $this->db->manipulateF(
$query, $types, $values);
448 $query =
"UPDATE {$this->table_mail} SET m_status = %s WHERE user_id = %s ";
449 array_push($types,
'text',
'integer');
450 array_push($values,
'unread', $this->user_id);
452 if (count($mailIds) > 0) {
453 $query .=
' AND ' . $this->db->in(
'mail_id', $mailIds,
false,
'integer');
456 $this->db->manipulateF(
$query, $types, $values);
469 $mailIds = array_filter(array_map(
'intval', $mailIds));
471 if (0 === count($mailIds)) {
476 "UPDATE {$this->table_mail} " .
477 "INNER JOIN mail_obj_data " .
478 "ON mail_obj_data.obj_id = %s AND mail_obj_data.user_id = %s " .
479 "SET {$this->table_mail}.folder_id = mail_obj_data.obj_id " .
480 "WHERE {$this->table_mail}.user_id = %s";
481 array_push($types,
'integer',
'integer',
'integer');
482 array_push($values, $folderId, $this->user_id, $this->user_id);
484 $query .=
' AND ' . $this->db->in(
'mail_id', $mailIds,
false,
'integer');
486 $affectedRows = $this->db->manipulateF(
$query, $types, $values);
488 return $affectedRows > 0;
496 $mailIds = array_filter(array_map(
'intval', $mailIds));
497 foreach ($mailIds as $id) {
498 $this->db->manipulateF(
499 "DELETE FROM {$this->table_mail} WHERE user_id = %s AND mail_id = %s",
500 [
'integer',
'integer'],
501 [$this->user_id, $id]
503 $this->mfile->deassignAttachmentFromDirectory($id);
513 if (!is_array($row) || empty($row)) {
517 $row[
'attachments'] = unserialize(stripslashes($row[
'attachments']));
518 $row[
'tpl_ctx_params'] = (array) (@json_decode($row[
'tpl_ctx_params'],
true));
530 $nextId = (int) $this->db->nextId($this->table_mail);
531 $this->db->insert($this->table_mail, [
532 'mail_id' => [
'integer', $nextId],
533 'user_id' => [
'integer', $usrId],
534 'folder_id' => [
'integer', $folderId],
535 'sender_id' => [
'integer', $usrId]
551 $a_use_placeholders = 0,
552 $a_tpl_context_id =
null,
553 $a_tpl_context_params = []
558 'folder_id' => [
'integer', $a_folder_id],
559 'attachments' => [
'clob', serialize($a_attachments)],
560 'send_time' => [
'timestamp', date(
'Y-m-d H:i:s', time())],
561 'rcp_to' => [
'clob', $a_rcp_to],
562 'rcp_cc' => [
'clob', $a_rcp_cc],
563 'rcp_bcc' => [
'clob', $a_rcp_bcc],
564 'm_status' => [
'text',
'read'],
565 'm_email' => [
'integer', $a_m_email],
566 'm_subject' => [
'text', $a_m_subject],
567 'm_message' => [
'clob', $a_m_message],
568 'use_placeholders' => [
'integer', $a_use_placeholders],
569 'tpl_ctx_id' => [
'text', $a_tpl_context_id],
570 'tpl_ctx_params' => [
'blob', @json_encode((array) $a_tpl_context_params)]
573 'mail_id' => [
'integer', $a_draft_id]
609 $usePlaceholders = 0,
610 $templateContextId =
null,
611 $templateContextParameters = []
613 $usrId = $usrId ? $usrId : $this->user_id;
615 if ($usePlaceholders) {
655 $nextId = (int) $this->db->nextId($this->table_mail);
656 $this->db->insert($this->table_mail, array(
657 'mail_id' => array(
'integer', $nextId),
658 'user_id' => array(
'integer', $usrId),
659 'folder_id' => array(
'integer', $folderId),
660 'sender_id' => array(
'integer', $senderUsrId),
661 'attachments' => array(
'clob', serialize($attachments)),
662 'send_time' => array(
'timestamp', date(
'Y-m-d H:i:s', time())),
663 'rcp_to' => array(
'clob', $to),
664 'rcp_cc' => array(
'clob', $cc),
665 'rcp_bcc' => array(
'clob', $bcc),
666 'm_status' => array(
'text', $status),
667 'm_email' => array(
'integer',
$email),
668 'm_subject' => array(
'text', $subject),
669 'm_message' => array(
'clob',
$message),
670 'tpl_ctx_id' => array(
'text', $templateContextId),
671 'tpl_ctx_params' => array(
'blob', @json_encode((array) $templateContextParameters))
674 $raiseEvent = (int) $usrId !== $this->mailbox->getUsrId();
676 $raiseEvent = (int) $folderId !== $this->mailbox->getSentFolder();
680 $this->eventHandler->raise(
'Services/Mail',
'sentInternalMail', [
682 'subject' => (
string) $subject,
684 'from_usr_id' => (
int) $senderUsrId,
685 'to_usr_id' => (int) $usrId,
686 'rcp_to' => (
string) $to,
687 'rcp_cc' => (string) $cc,
688 'rcp_bcc' => (
string) $bcc,
704 bool $replaceEmptyPlaceholders =
true
707 if ($this->contextId) {
713 $user = $usrId > 0 ? $this->getUserInstanceById($usrId) : null;
716 $message = $processor->resolve($user, $this->contextParameters, $replaceEmptyPlaceholders);
717 }
catch (Exception
$e) {
718 $this->logger->error(__METHOD__ .
' has been called with invalid context.');
743 bool $usePlaceholders =
false
745 if ($usePlaceholders) {
746 $toUsrIds = $this->getUserIds([$to]);
747 $this->logger->debug(sprintf(
748 "Parsed TO user ids from given recipients for serial letter notification: %s",
749 implode(
', ', $toUsrIds)
752 $this->sendChanneledMails(
764 $otherUsrIds = $this->getUserIds([$cc, $bcc]);
765 $this->logger->debug(sprintf(
766 "Parsed CC/BCC user ids from given recipients for serial letter notification: %s",
767 implode(
', ', $otherUsrIds)
770 $this->sendChanneledMails(
776 $this->replacePlaceholders(
$message, 0,
false),
782 $usrIds = $this->getUserIds([$to, $cc, $bcc]);
783 $this->logger->debug(sprintf(
784 "Parsed TO/CC/BCC user ids from given recipients: %s",
785 implode(
', ', $usrIds)
788 $this->sendChanneledMails(
824 bool $usePlaceholders =
false
826 $usrIdToExternalEmailAddressesMap = [];
827 $usrIdToMessageMap = [];
829 foreach ($usrIds as $usrId) {
830 $user = $this->getUserInstanceById($usrId);
831 $mailOptions = $this->getMailOptionsByUserId($user->getId());
833 $canReadInternalMails = !$user->hasToAcceptTermsOfService() && $user->checkTimeLimit();
835 if ($this->isSystemMail() && !$canReadInternalMails) {
836 $this->logger->debug(sprintf(
837 "Skipped recipient with id %s (Accepted User Agreement:%s|Expired Account:%s)",
839 var_export(!$user->hasToAcceptTermsOfService(),
true),
840 var_export(!$user->checkTimeLimit(),
true)
846 if ($usePlaceholders) {
847 $individualMessage = $this->replacePlaceholders(
$message, $user->getId());
848 $usrIdToMessageMap[$user->getId()] = $individualMessage;
851 if ($user->getActive()) {
852 $wantsToReceiveExternalEmail = (
857 if (!$canReadInternalMails || $wantsToReceiveExternalEmail) {
858 $emailAddresses = $mailOptions->getExternalEmailAddresses();
859 $usrIdToExternalEmailAddressesMap[$user->getId()] = $emailAddresses;
862 $this->logger->debug(sprintf(
863 "Recipient with id %s will only receive external emails sent to: %s",
865 implode(
', ', $emailAddresses)
869 $this->logger->debug(sprintf(
870 "Recipient with id %s will additionally receive external emails " .
871 "(because the user wants to receive it externally, or the user cannot access " .
872 "the internal mail system) sent to: %s",
874 implode(
', ', $emailAddresses)
878 $this->logger->debug(sprintf(
879 "Recipient with id %s is does not want to receive external emails",
884 $this->logger->debug(sprintf(
885 "Recipient with id %s is inactive and will not receive external emails",
890 $mbox = clone $this->mailbox;
891 $mbox->setUsrId((
int) $user->getId());
892 $recipientInboxId = $mbox->getInboxFolder();
894 $internalMailId = $this->sendInternalMail(
909 if (count($attachments) > 0) {
910 $this->mfile->assignAttachmentsToDirectory($internalMailId, $sentMailId);
914 $this->delegateExternalEmails(
919 $usrIdToExternalEmailAddressesMap,
936 bool $usePlaceholders,
937 array $usrIdToExternalEmailAddressesMap,
938 array $usrIdToMessageMap
940 if (1 === count($usrIdToExternalEmailAddressesMap)) {
941 if ($usePlaceholders) {
942 $message = array_values($usrIdToMessageMap)[0];
945 $usrIdToExternalEmailAddressesMap = array_values($usrIdToExternalEmailAddressesMap);
946 $firstAddresses = current($usrIdToExternalEmailAddressesMap);
949 implode(
',', $firstAddresses),
953 $this->formatLinebreakMessage(
$message),
956 } elseif (count($usrIdToExternalEmailAddressesMap) > 1) {
957 if ($usePlaceholders) {
958 foreach ($usrIdToExternalEmailAddressesMap as $usrId => $addresses) {
959 if (0 === count($addresses)) {
964 implode(
',', $addresses),
968 $this->formatLinebreakMessage($usrIdToMessageMap[$usrId]),
973 $flattenEmailAddresses = iterator_to_array(
new RecursiveIteratorIterator(
new RecursiveArrayIterator(
974 $usrIdToExternalEmailAddressesMap
977 $flattenEmailAddresses = array_unique($flattenEmailAddresses);
980 $remainingAddresses =
'';
981 foreach ($flattenEmailAddresses as $emailAddress) {
983 if (strlen($remainingAddresses) > 0) {
988 if ($recipientsLineLength >= $this->maxRecipientCharacterLength) {
994 $this->formatLinebreakMessage(
$message),
998 $remainingAddresses =
'';
1002 $remainingAddresses .= ($sep . $emailAddress);
1005 if (
'' !== $remainingAddresses) {
1006 $this->sendMimeMail(
1009 $remainingAddresses,
1011 $this->formatLinebreakMessage(
$message),
1012 (array) $attachments
1027 $joinedRecipients = implode(
',', array_filter(array_map(
'trim', $recipients)));
1029 $addresses = $this->parseAddresses($joinedRecipients);
1030 foreach ($addresses as $address) {
1031 $addressType = $this->mailAddressTypeFactory->getByPrefix($address);
1032 $usrIds = array_merge($usrIds, $addressType->resolve());
1035 return array_unique($usrIds);
1045 protected function checkMail(
string $to,
string $cc,
string $bcc,
string $subject) : array
1050 $subject =>
'mail_add_subject',
1051 $to =>
'mail_add_recipient'
1052 ] as $string => $error
1054 if (0 === strlen($string)) {
1073 $addresses = $this->parseAddresses($recipients);
1074 foreach ($addresses as $address) {
1075 $addressType = $this->mailAddressTypeFactory->getByPrefix($address);
1076 if (!$addressType->validate($this->user_id)) {
1077 $newErrors = $addressType->getErrors();
1082 $colonPosition = strpos(
$e->getMessage(),
':');
1084 ($colonPosition ===
false) ?
$e->getMessage() : substr(
$e->getMessage(), $colonPosition + 2)
1116 $a_use_placeholders,
1117 $a_tpl_context_id =
null,
1118 $a_tpl_ctx_params = array()
1120 if (!$a_attachments) {
1121 $a_attachments =
null;
1135 if (!$a_m_message) {
1136 $a_m_message =
null;
1138 if (!$a_use_placeholders) {
1139 $a_use_placeholders =
'0';
1143 $this->table_mail_saved,
1145 'user_id' => [
'integer', $this->user_id]
1148 'attachments' => [
'clob', serialize($a_attachments)],
1149 'rcp_to' => [
'clob', $a_rcp_to],
1150 'rcp_cc' => [
'clob', $a_rcp_cc],
1151 'rcp_bcc' => [
'clob', $a_rcp_bcc],
1152 'm_email' => [
'integer', $a_m_email],
1153 'm_subject' => [
'text', $a_m_subject],
1154 'm_message' => [
'clob', $a_m_message],
1155 'use_placeholders' => [
'integer', $a_use_placeholders],
1156 'tpl_ctx_id' => [
'text', $a_tpl_context_id],
1157 'tpl_ctx_params' => [
'blob', json_encode((array) $a_tpl_ctx_params)]
1161 $this->getSavedData();
1171 $res = $this->db->queryF(
1172 "SELECT * FROM {$this->table_mail_saved} WHERE user_id = %s",
1177 $this->mail_data = $this->fetchMailData($this->db->fetchAssoc(
$res));
1179 return $this->mail_data;
1200 $a_use_placeholders = 0
1204 $this->logger->debug(
1205 "New mail system task:" .
1206 " To: " . $a_rcp_to .
1207 " | CC: " . $a_rcp_cc .
1208 " | BCC: " . $a_rcp_bcc .
1209 " | Subject: " . $a_m_subject
1212 if ($a_attachment && !$this->mfile->checkFilesExist($a_attachment)) {
1213 return [
new ilMailError(
'mail_attachment_file_not_exist', [$a_attachment])];
1216 $errors = $this->checkMail((
string) $a_rcp_to, (
string) $a_rcp_cc, (
string) $a_rcp_bcc, (
string) $a_m_subject);
1221 $errors = $this->validateRecipients((
string) $a_rcp_to, (
string) $a_rcp_cc, (
string) $a_rcp_bcc);
1226 $rcp_to = $a_rcp_to;
1227 $rcp_cc = $a_rcp_cc;
1228 $rcp_bcc = $a_rcp_bcc;
1230 if (
null === $rcp_cc) {
1234 if (
null === $rcp_bcc) {
1238 $numberOfExternalAddresses = $this->getCountRecipients($rcp_to, $rcp_cc, $rcp_bcc,
true);
1240 $numberOfExternalAddresses > 0 &&
1241 !$this->isSystemMail() &&
1242 !
$DIC->rbac()->system()->checkAccessOfUser($this->user_id,
'smtp_mail', $this->mail_obj_ref_id)
1244 return [
new ilMailError(
'mail_no_permissions_write_smtp')];
1247 if ($this->appendInstallationSignature()) {
1248 $a_m_message .= self::_getInstallationSignature();
1252 return $this->sendMail(
1256 (
string) $a_m_subject,
1257 (
string) $a_m_message,
1258 (array) $a_attachment,
1259 (
bool) $a_use_placeholders
1263 $taskFactory =
$DIC->backgroundTasks()->taskFactory();
1264 $taskManager =
$DIC->backgroundTasks()->taskManager();
1267 $bucket->setUserId($this->user_id);
1269 $task = $taskFactory->createTask(ilMailDeliveryJob::class, [
1270 (
int) $this->user_id,
1274 (
string) $a_m_subject,
1275 (
string) $a_m_message,
1276 (
string) serialize($a_attachment),
1277 (
bool) $a_use_placeholders,
1278 (
bool) $this->getSaveInSentbox(),
1279 (
string) $this->contextId,
1280 (
string) serialize($this->contextParameters)
1282 $interaction = $taskFactory->createTask(ilMailDeliveryJobUserInteraction::class, [
1284 (
int) $this->user_id
1287 $bucket->setTask($interaction);
1288 $bucket->setTitle($this->lng->txt(
'mail_bg_task_title'));
1289 $bucket->setDescription(sprintf($this->lng->txt(
'mail_bg_task_desc'), $a_m_subject));
1291 $this->logger->info(
'Delegated delivery to background task');
1292 $taskManager->run($bucket);
1318 bool $usePlaceholders
1320 $internalMessageId = $this->saveInSentbox(
1329 if (count($attachments) > 0) {
1330 $this->mfile->assignAttachmentsToDirectory($internalMessageId, $internalMessageId);
1331 $this->mfile->saveFiles($internalMessageId, $attachments);
1334 $numberOfExternalAddresses = $this->getCountRecipients($to, $cc, $bcc,
true);
1336 if ($numberOfExternalAddresses > 0) {
1337 $externalMailRecipientsTo = $this->getEmailRecipients($to);
1338 $externalMailRecipientsCc = $this->getEmailRecipients($cc);
1339 $externalMailRecipientsBcc = $this->getEmailRecipients($bcc);
1341 $this->logger->debug(
1342 "Parsed external email addresses from given recipients /" .
1343 " To: " . $externalMailRecipientsTo .
1344 " | CC: " . $externalMailRecipientsCc .
1345 " | BCC: " . $externalMailRecipientsBcc .
1346 " | Subject: " . $subject
1349 $this->sendMimeMail(
1350 $externalMailRecipientsTo,
1351 $externalMailRecipientsCc,
1352 $externalMailRecipientsBcc,
1354 $this->formatLinebreakMessage(
1355 $usePlaceholders ? $this->replacePlaceholders(
$message, 0,
false) :
$message
1360 $this->logger->debug(
'No external email addresses given in recipient string');
1365 if (!$this->distributeMail(
1378 if (!$this->getSaveInSentbox()) {
1379 $this->deleteMails([$internalMessageId]);
1403 return [
new ilMailError(
'mail_generic_rcp_error', [
$e->getMessage()])];
1427 return $this->sendInternalMail(
1428 $this->mailbox->getSentFolder(),
1454 $mailer->From($this->senderFactory->getSenderByUsrId((
int) $this->user_id));
1456 $mailer->Subject($subject,
true);
1467 foreach ($attachments as $attachment) {
1469 $this->mfile->getAbsoluteAttachmentPoolPathByFilename($attachment),
1485 $this->table_mail_saved,
1487 'attachments' => [
'clob', serialize($attachments)]
1490 'user_id' => [
'integer', $this->user_id]
1503 if (strlen($addresses) > 0) {
1504 $this->logger->debug(sprintf(
1505 "Started parsing of recipient string: %s",
1510 $parser = $this->mailAddressParserFactory->getParser((
string) $addresses);
1511 $parsedAddresses =
$parser->parse();
1513 if (strlen($addresses) > 0) {
1514 $this->logger->debug(sprintf(
1515 "Parsed addresses: %s",
1517 return (
string) $address;
1518 }, $parsedAddresses))
1522 return $parsedAddresses;
1533 if ($onlyExternalAddresses) {
1537 $this->usrIdByLoginCallable
1541 return count($addresses->value());
1552 string $toRecipients,
1553 string $ccRecipients,
1554 string $bccRecipients,
1555 $onlyExternalAddresses =
true
1558 $this->getCountRecipient($toRecipients, $onlyExternalAddresses) +
1559 $this->getCountRecipient($ccRecipients, $onlyExternalAddresses) +
1560 $this->getCountRecipient($bccRecipients, $onlyExternalAddresses)
1573 $this->usrIdByLoginCallable
1576 $emailRecipients = array_map(
function (
ilMailAddress $address) {
1577 return (
string) $address;
1578 }, $addresses->value());
1580 return implode(
',', $emailRecipients);
1596 $lang->loadLanguageModule(
'mail');
1599 $lang->txt(
'mail_auto_generated_info'),
1608 public static function _getIliasMailerName() : string
1611 $senderFactory =
$GLOBALS[
"DIC"][
"mail.mime.sender.factory"];
1613 return $senderFactory->system()->getFromName();
1622 if (
null === $a_flag) {
1623 return $this->appendInstallationSignature;
1626 $this->appendInstallationSignature = $a_flag;
1637 $signature =
$DIC->settings()->get(
'mail_system_sys_signature');
1640 $clientdirs = glob(ILIAS_WEB_DIR .
'/*', GLOB_ONLYDIR);
1641 if (is_array($clientdirs) && count($clientdirs) > 1) {
1642 $clientUrl .=
'/login.php?client_id=' . CLIENT_ID;
1645 $signature = str_ireplace(
'[CLIENT_NAME]',
$DIC[
'ilClientIniFile']->
readVariable(
'client',
'name'), $signature);
1646 $signature = str_ireplace(
1651 $signature = str_ireplace(
'[CLIENT_URL]', $clientUrl, $signature);
1653 if (!preg_match(
'/^[\n\r]+/', $signature)) {
1654 $signature =
"\n" . $signature;
1670 $lang->loadLanguageModule(
'mail');
1673 $gender = $gender ? $gender :
'n';
1676 if (!strlen(
$name[
'firstname'])) {
1677 return $lang->txt(
'mail_salutation_anonymous') .
',';
1681 $lang->txt(
'mail_salutation_' . $gender) .
' ' .
1682 (
$name[
'title'] ?
$name[
'title'] .
' ' :
'') .
1683 (
$name[
'firstname'] ?
$name[
'firstname'] .
' ' :
'') .
1684 $name[
'lastname'] .
',';
1693 if (!isset($this->userInstancesByIdMap[$usrId])) {
1694 $this->userInstancesByIdMap[$usrId] =
new ilObjUser($usrId);
1697 return $this->userInstancesByIdMap[$usrId];
1706 $this->userInstancesByIdMap = $userInstanceByIdMap;
1715 if (!isset($this->mailOptionsByUsrIdMap[$usrId])) {
1716 $this->mailOptionsByUsrIdMap[$usrId] =
new ilMailOptions($usrId);
1719 return $this->mailOptionsByUsrIdMap[$usrId];
1728 $this->mailOptionsByUsrIdMap = $mailOptionsByUsrIdMap;
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
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.
static _getLanguage($a_lang_key='')
Get langauge object.
static getLogger($a_component_id)
Get component logger.
Component logger with individual log levels by component id.
Class ilMailAddressListImpl.
Class ilMailAddressTypeFactory.
Class ilMailDiffAddressList.
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable.
Class ilMailMimeSenderFactory.
Class ilMailOnlyExternalAddressList.
Class ilMailOptions this class handles user mails.
Class ilMailRfc822AddressParserFactory.
static getTemplateContextById($a_id)
Class ilMailTemplatePlaceholderResolver.
savePostData( $a_user_id, $a_attachments, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $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
$maxRecipientCharacterLength
static _getAutoGeneratedMessageString(ilLanguage $lang=null)
Get auto generated info string.
withContextId(string $contextId)
$mailAddressParserFactory
withContextParameters(array $parameters)
getCountRecipient(string $recipients, $onlyExternalAddresses=true)
enqueue( $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject, $a_m_message, $a_attachment, $a_use_placeholders=0)
Should be used to enqueue a 'mail'.
deleteMailsOfFolder(int $folderId)
replacePlaceholders(string $message, int $usrId=0, bool $replaceEmptyPlaceholders=true)
getUserIds(array $recipients)
distributeMail(string $to, string $cc, string $bcc, string $subject, string $message, array $attachments, int $sentMailId, bool $usePlaceholders=false)
checkRecipients(string $recipients)
Check if recipients are valid.
setUserInstanceById(array $userInstanceByIdMap)
moveMailsToFolder(array $mailIds, int $folderId)
deleteMails(array $mailIds)
saveAttachments(array $attachments)
__construct( $a_user_id, ilMailAddressTypeFactory $mailAddressTypeFactory=null, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null, ilAppEventHandler $eventHandler=null, ilLogger $logger=null, ilDBInterface $db=null, ilLanguage $lng=null, ilFileDataMail $mailFileData=null, ilMailOptions $mailOptions=null, ilMailbox $mailBox=null, ilMailMimeSenderFactory $senderFactory=null, callable $usrIdByLoginCallable=null, int $mailAdminNodeRefId=null)
formatNamesForOutput(string $recipients)
Prepends the full name of each ILIAS login name (if user has a public profile) found in the passed st...
sendChanneledMails(string $to, string $cc, string $bcc, array $usrIds, string $subject, string $message, array $attachments, int $sentMailId, bool $usePlaceholders=false)
setSaveInSentbox(bool $saveInSentbox)
sendMimeMail(string $to, string $cc, string $bcc, $subject, $message, array $attachments)
delegateExternalEmails(string $subject, string $message, array $attachments, bool $usePlaceholders, array $usrIdToExternalEmailAddressesMap, array $usrIdToMessageMap)
getMailsOfFolder($a_folder_id, $filter=[])
getPreviousMail(int $mailId)
updateDraft( $a_folder_id, $a_attachments, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $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=[])
validateRecipients(string $to, string $cc, string $bcc)
setMailOptionsByUserIdMap(array $mailOptionsByUsrIdMap)
static _getInstallationSignature()
saveInSentbox(array $attachment, string $to, string $cc, string $bcc, string $subject, string $message)
Stores a message in the sent bod of the current user.
appendInstallationSignature(bool $a_flag=null)
formatLinebreakMessage(string $message)
getUserInstanceById(int $usrId)
getEmailRecipients(string $recipients)
$appendInstallationSignature
checkMail(string $to, string $cc, string $bcc, string $subject)
sendInternalMail( $folderId, $senderUsrId, $attachments, $to, $cc, $bcc, $status, $email, $subject, $message, $usrId=0, $usePlaceholders=0, $templateContextId=null, $templateContextParameters=[])
static getSalutation($a_usr_id, ilLanguage $a_language=null)
existsRecipient(string $newRecipient, string $existingRecipients)
parseAddresses($addresses)
Explode recipient string, allowed separators are ',' ';' ' ' Returns an array with recipient ilMailAd...
sendMail(string $to, string $cc, string $bcc, string $subject, string $message, array $attachments, bool $usePlaceholders)
This method is used to finally send internal messages and external emails To use the mail system as a...
getMailOptionsByUserId(int $usrId)
getMailObjectReferenceId()
getCountRecipients(string $toRecipients, string $ccRecipients, string $bccRecipients, $onlyExternalAddresses=true)
readMailObjectReferenceId()
Read and set the mail object ref id (administration node)
getNewDraftId(int $usrId, int $folderId)
fetchMailData(?array $row)
countMailsOfFolder(int $folderId)
markUnread(array $mailIds)
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(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
const ILIAS_VERSION_NUMERIC
foreach($_POST as $key=> $value) $res