112 int $mailAdminNodeRefId =
null
134 if ($mailFileData ===
null) {
137 if ($mailOptions ===
null) {
140 if ($mailBox ===
null) {
152 $this->user_id = (int) $a_user_id;
159 $this->mfile = $mailFileData;
160 $this->mail_options = $mailOptions;
161 $this->mailbox = $mailBox;
165 $this->mail_obj_ref_id = $mailAdminNodeRefId;
166 if (
null === $this->mail_obj_ref_id) {
170 $this->lng->loadLanguageModule(
'mail');
171 $this->table_mail =
'mail';
172 $this->table_mail_saved =
'mail_saved';
182 $clone = clone $this;
195 $clone = clone $this;
197 $clone->contextParameters = $parameters;
215 public function existsRecipient(
string $newRecipient,
string $existingRecipients) : bool
222 $diffedAddresses = $list->value();
224 return count($diffedAddresses) === 0;
232 $this->save_in_sentbox = (bool) $saveInSentbox;
269 $recipients = trim($recipients);
270 if (0 === strlen($recipients)) {
271 return $this->lng->txt(
'not_available');
276 $recipients = array_filter(array_map(
'trim', explode(
',', $recipients)));
277 foreach ($recipients as $recipient) {
281 if ($pp ===
'g' || ($pp ===
'y' && !
$DIC->user()->isAnonymous())) {
284 $names[] = $user->getFullname() .
' [' . $recipient .
']';
290 $names[] = $recipient;
293 return implode(
', ', $names);
302 $this->db->setLimit(1, 0);
305 "SELECT b.* FROM {$this->table_mail} a",
306 "INNER JOIN {$this->table_mail} b ON b.folder_id = a.folder_id",
307 'AND b.user_id = a.user_id AND b.send_time > a.send_time',
308 'WHERE a.user_id = %s AND a.mail_id = %s ORDER BY b.send_time ASC',
310 $res = $this->db->queryF(
312 [
'integer',
'integer'],
313 [$this->user_id, $mailId]
327 $this->db->setLimit(1, 0);
330 "SELECT b.* FROM {$this->table_mail} a",
331 "INNER JOIN {$this->table_mail} b ON b.folder_id = a.folder_id",
332 'AND b.user_id = a.user_id AND b.send_time < a.send_time',
333 'WHERE a.user_id = %s AND a.mail_id = %s ORDER BY b.send_time DESC',
335 $res = $this->db->queryF(
337 [
'integer',
'integer'],
338 [$this->user_id, $mailId]
356 "SELECT sender_id, m_subject, mail_id, m_status, send_time " .
357 "FROM {$this->table_mail} " .
358 "LEFT JOIN object_data ON obj_id = sender_id " .
359 "WHERE user_id = %s AND folder_id = %s " .
360 "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))";
362 if (isset($filter[
'status']) && strlen($filter[
'status']) > 0) {
363 $query .=
' AND m_status = ' . $this->db->quote($filter[
'status'],
'text');
366 $query .=
" ORDER BY send_time DESC";
368 $res = $this->db->queryF(
370 [
'integer',
'integer'],
371 [$this->user_id, $a_folder_id]
374 while ($row = $this->db->fetchAssoc(
$res)) {
378 return array_filter($mails);
387 $res = $this->db->queryF(
388 "SELECT COUNT(*) FROM {$this->table_mail} WHERE user_id = %s AND folder_id = %s",
389 [
'integer',
'integer'],
390 [$this->user_id, $folderId]
393 return $this->db->numRows(
$res);
413 $res = $this->db->queryF(
414 "SELECT * FROM {$this->table_mail} WHERE user_id = %s AND mail_id = %s",
415 [
'integer',
'integer'],
416 [$this->user_id, $mailId]
432 $query =
"UPDATE {$this->table_mail} SET m_status = %s WHERE user_id = %s ";
433 array_push($types,
'text',
'integer');
434 array_push($values,
'read', $this->user_id);
436 if (count($mailIds) > 0) {
437 $query .=
' AND ' . $this->db->in(
'mail_id', $mailIds,
false,
'integer');
440 $this->db->manipulateF(
$query, $types, $values);
451 $query =
"UPDATE {$this->table_mail} SET m_status = %s WHERE user_id = %s ";
452 array_push($types,
'text',
'integer');
453 array_push($values,
'unread', $this->user_id);
455 if (count($mailIds) > 0) {
456 $query .=
' AND ' . $this->db->in(
'mail_id', $mailIds,
false,
'integer');
459 $this->db->manipulateF(
$query, $types, $values);
472 $mailIds = array_filter(array_map(
'intval', $mailIds));
474 if (0 === count($mailIds)) {
479 "UPDATE {$this->table_mail} " .
480 "INNER JOIN mail_obj_data " .
481 "ON mail_obj_data.obj_id = %s AND mail_obj_data.user_id = %s " .
482 "SET {$this->table_mail}.folder_id = mail_obj_data.obj_id " .
483 "WHERE {$this->table_mail}.user_id = %s";
484 array_push($types,
'integer',
'integer',
'integer');
485 array_push($values, $folderId, $this->user_id, $this->user_id);
487 $query .=
' AND ' . $this->db->in(
'mail_id', $mailIds,
false,
'integer');
489 $affectedRows = $this->db->manipulateF(
$query, $types, $values);
491 return $affectedRows > 0;
499 $mailIds = array_filter(array_map(
'intval', $mailIds));
500 foreach ($mailIds as $id) {
501 $this->db->manipulateF(
502 "DELETE FROM {$this->table_mail} WHERE user_id = %s AND mail_id = %s",
503 [
'integer',
'integer'],
504 [$this->user_id, $id]
506 $this->mfile->deassignAttachmentFromDirectory($id);
516 if (!is_array($row) || empty($row)) {
520 $row[
'attachments'] = unserialize(stripslashes($row[
'attachments']));
521 $row[
'tpl_ctx_params'] = (array) (@json_decode($row[
'tpl_ctx_params'],
true));
533 $nextId = (int) $this->db->nextId($this->table_mail);
534 $this->db->insert($this->table_mail, [
535 'mail_id' => [
'integer', $nextId],
536 'user_id' => [
'integer', $usrId],
537 'folder_id' => [
'integer', $folderId],
538 'sender_id' => [
'integer', $usrId]
554 $a_use_placeholders = 0,
555 $a_tpl_context_id =
null,
556 $a_tpl_context_params = []
561 'folder_id' => [
'integer', $a_folder_id],
562 'attachments' => [
'clob', serialize($a_attachments)],
563 'send_time' => [
'timestamp', date(
'Y-m-d H:i:s', time())],
564 'rcp_to' => [
'clob', $a_rcp_to],
565 'rcp_cc' => [
'clob', $a_rcp_cc],
566 'rcp_bcc' => [
'clob', $a_rcp_bcc],
567 'm_status' => [
'text',
'read'],
568 'm_email' => [
'integer', $a_m_email],
569 'm_subject' => [
'text', $a_m_subject],
570 'm_message' => [
'clob', $a_m_message],
571 'use_placeholders' => [
'integer', $a_use_placeholders],
572 'tpl_ctx_id' => [
'text', $a_tpl_context_id],
573 'tpl_ctx_params' => [
'blob', @json_encode((array) $a_tpl_context_params)]
576 'mail_id' => [
'integer', $a_draft_id]
612 $usePlaceholders = 0,
613 $templateContextId =
null,
614 $templateContextParameters = []
616 $usrId = $usrId ? $usrId : $this->user_id;
618 if ($usePlaceholders) {
658 $nextId = (int) $this->db->nextId($this->table_mail);
659 $this->db->insert($this->table_mail, array(
660 'mail_id' => array(
'integer', $nextId),
661 'user_id' => array(
'integer', $usrId),
662 'folder_id' => array(
'integer', $folderId),
663 'sender_id' => array(
'integer', $senderUsrId),
664 'attachments' => array(
'clob', serialize($attachments)),
665 'send_time' => array(
'timestamp', date(
'Y-m-d H:i:s', time())),
666 'rcp_to' => array(
'clob', $to),
667 'rcp_cc' => array(
'clob', $cc),
668 'rcp_bcc' => array(
'clob', $bcc),
669 'm_status' => array(
'text', $status),
670 'm_email' => array(
'integer',
$email),
671 'm_subject' => array(
'text', $subject),
672 'm_message' => array(
'clob',
$message),
673 'tpl_ctx_id' => array(
'text', $templateContextId),
674 'tpl_ctx_params' => array(
'blob', @json_encode((array) $templateContextParameters))
677 $raiseEvent = (int) $usrId !== $this->mailbox->getUsrId();
679 $raiseEvent = (int) $folderId !== $this->mailbox->getSentFolder();
683 $this->eventHandler->raise(
'Services/Mail',
'sentInternalMail', [
685 'subject' => (
string) $subject,
687 'from_usr_id' => (
int) $senderUsrId,
688 'to_usr_id' => (int) $usrId,
689 'rcp_to' => (
string) $to,
690 'rcp_cc' => (string) $cc,
691 'rcp_bcc' => (
string) $bcc,
707 bool $replaceEmptyPlaceholders =
true
710 if ($this->contextId) {
716 $user = $usrId > 0 ? $this->getUserInstanceById($usrId) : null;
719 $message = $processor->resolve($user, $this->contextParameters, $replaceEmptyPlaceholders);
720 }
catch (Exception
$e) {
721 $this->logger->error(__METHOD__ .
' has been called with invalid context.');
746 bool $usePlaceholders =
false
748 if ($usePlaceholders) {
749 $toUsrIds = $this->getUserIds([$to]);
750 $this->logger->debug(sprintf(
751 "Parsed TO user ids from given recipients for serial letter notification: %s",
752 implode(
', ', $toUsrIds)
755 $this->sendChanneledMails(
767 $otherUsrIds = $this->getUserIds([$cc, $bcc]);
768 $this->logger->debug(sprintf(
769 "Parsed CC/BCC user ids from given recipients for serial letter notification: %s",
770 implode(
', ', $otherUsrIds)
773 $this->sendChanneledMails(
779 $this->replacePlaceholders(
$message, 0,
false),
785 $usrIds = $this->getUserIds([$to, $cc, $bcc]);
786 $this->logger->debug(sprintf(
787 "Parsed TO/CC/BCC user ids from given recipients: %s",
788 implode(
', ', $usrIds)
791 $this->sendChanneledMails(
827 bool $usePlaceholders =
false
829 $usrIdToExternalEmailAddressesMap = [];
830 $usrIdToMessageMap = [];
832 foreach ($usrIds as $usrId) {
833 $user = $this->getUserInstanceById($usrId);
835 $this->logger->critical(sprintf(
836 "Skipped recipient with id %s (User not found)",
842 $mailOptions = $this->getMailOptionsByUserId($user->getId());
844 $canReadInternalMails = !$user->hasToAcceptTermsOfService() && $user->checkTimeLimit();
846 if ($this->isSystemMail() && !$canReadInternalMails) {
847 $this->logger->debug(sprintf(
848 "Skipped recipient with id %s (Accepted User Agreement:%s|Expired Account:%s)",
850 var_export(!$user->hasToAcceptTermsOfService(),
true),
851 var_export(!$user->checkTimeLimit(),
true)
857 if ($usePlaceholders) {
858 $individualMessage = $this->replacePlaceholders(
$message, $user->getId());
859 $usrIdToMessageMap[$user->getId()] = $individualMessage;
862 if ($user->getActive()) {
863 $wantsToReceiveExternalEmail = (
868 if (!$canReadInternalMails || $wantsToReceiveExternalEmail) {
869 $emailAddresses = $mailOptions->getExternalEmailAddresses();
870 $usrIdToExternalEmailAddressesMap[$user->getId()] = $emailAddresses;
873 $this->logger->debug(sprintf(
874 "Recipient with id %s will only receive external emails sent to: %s",
876 implode(
', ', $emailAddresses)
880 $this->logger->debug(sprintf(
881 "Recipient with id %s will additionally receive external emails " .
882 "(because the user wants to receive it externally, or the user cannot access " .
883 "the internal mail system) sent to: %s",
885 implode(
', ', $emailAddresses)
889 $this->logger->debug(sprintf(
890 "Recipient with id %s is does not want to receive external emails",
895 $this->logger->debug(sprintf(
896 "Recipient with id %s is inactive and will not receive external emails",
901 $mbox = clone $this->mailbox;
902 $mbox->setUsrId((
int) $user->getId());
903 $recipientInboxId = $mbox->getInboxFolder();
905 $internalMailId = $this->sendInternalMail(
920 if (count($attachments) > 0) {
921 $this->mfile->assignAttachmentsToDirectory($internalMailId, $sentMailId);
925 $this->delegateExternalEmails(
930 $usrIdToExternalEmailAddressesMap,
947 bool $usePlaceholders,
948 array $usrIdToExternalEmailAddressesMap,
949 array $usrIdToMessageMap
951 if (1 === count($usrIdToExternalEmailAddressesMap)) {
952 if ($usePlaceholders) {
953 $message = array_values($usrIdToMessageMap)[0];
956 $usrIdToExternalEmailAddressesMap = array_values($usrIdToExternalEmailAddressesMap);
957 $firstAddresses = current($usrIdToExternalEmailAddressesMap);
960 implode(
',', $firstAddresses),
964 $this->formatLinebreakMessage(
$message),
967 } elseif (count($usrIdToExternalEmailAddressesMap) > 1) {
968 if ($usePlaceholders) {
969 foreach ($usrIdToExternalEmailAddressesMap as $usrId => $addresses) {
970 if (0 === count($addresses)) {
975 implode(
',', $addresses),
979 $this->formatLinebreakMessage($usrIdToMessageMap[$usrId]),
984 $flattenEmailAddresses = iterator_to_array(
new RecursiveIteratorIterator(
new RecursiveArrayIterator(
985 $usrIdToExternalEmailAddressesMap
988 $flattenEmailAddresses = array_unique($flattenEmailAddresses);
991 $remainingAddresses =
'';
992 foreach ($flattenEmailAddresses as $emailAddress) {
994 if (strlen($remainingAddresses) > 0) {
999 if ($recipientsLineLength >= $this->maxRecipientCharacterLength) {
1000 $this->sendMimeMail(
1003 $remainingAddresses,
1005 $this->formatLinebreakMessage(
$message),
1006 (array) $attachments
1009 $remainingAddresses =
'';
1013 $remainingAddresses .= ($sep . $emailAddress);
1016 if (
'' !== $remainingAddresses) {
1017 $this->sendMimeMail(
1020 $remainingAddresses,
1022 $this->formatLinebreakMessage(
$message),
1023 (array) $attachments
1038 $joinedRecipients = implode(
',', array_filter(array_map(
'trim', $recipients)));
1040 $addresses = $this->parseAddresses($joinedRecipients);
1041 foreach ($addresses as $address) {
1042 $addressType = $this->mailAddressTypeFactory->getByPrefix($address);
1043 $usrIds = array_merge($usrIds, $addressType->resolve());
1046 return array_unique($usrIds);
1056 protected function checkMail(
string $to,
string $cc,
string $bcc,
string $subject) : array
1061 $subject =>
'mail_add_subject',
1062 $to =>
'mail_add_recipient'
1063 ] as $string => $error
1065 if (0 === strlen($string)) {
1084 $addresses = $this->parseAddresses($recipients);
1085 foreach ($addresses as $address) {
1086 $addressType = $this->mailAddressTypeFactory->getByPrefix($address);
1087 if (!$addressType->validate($this->user_id)) {
1088 $newErrors = $addressType->getErrors();
1093 $colonPosition = strpos(
$e->getMessage(),
':');
1095 ($colonPosition ===
false) ?
$e->getMessage() : substr(
$e->getMessage(), $colonPosition + 2)
1127 $a_use_placeholders,
1128 $a_tpl_context_id =
null,
1129 $a_tpl_ctx_params = array()
1131 if (!$a_attachments) {
1132 $a_attachments =
null;
1146 if (!$a_m_message) {
1147 $a_m_message =
null;
1149 if (!$a_use_placeholders) {
1150 $a_use_placeholders =
'0';
1154 $this->table_mail_saved,
1156 'user_id' => [
'integer', $this->user_id]
1159 'attachments' => [
'clob', serialize($a_attachments)],
1160 'rcp_to' => [
'clob', $a_rcp_to],
1161 'rcp_cc' => [
'clob', $a_rcp_cc],
1162 'rcp_bcc' => [
'clob', $a_rcp_bcc],
1163 'm_email' => [
'integer', $a_m_email],
1164 'm_subject' => [
'text', $a_m_subject],
1165 'm_message' => [
'clob', $a_m_message],
1166 'use_placeholders' => [
'integer', $a_use_placeholders],
1167 'tpl_ctx_id' => [
'text', $a_tpl_context_id],
1168 'tpl_ctx_params' => [
'blob', json_encode((array) $a_tpl_ctx_params)]
1172 $this->getSavedData();
1182 $res = $this->db->queryF(
1183 "SELECT * FROM {$this->table_mail_saved} WHERE user_id = %s",
1188 $this->mail_data = $this->fetchMailData($this->db->fetchAssoc(
$res));
1190 return $this->mail_data;
1211 $a_use_placeholders = 0
1215 $this->logger->info(
1216 "New mail system task:" .
1217 " To: " . $a_rcp_to .
1218 " | CC: " . $a_rcp_cc .
1219 " | BCC: " . $a_rcp_bcc .
1220 " | Subject: " . $a_m_subject .
1221 " | Attachments: " . print_r($a_attachment,
true)
1224 if ($a_attachment && !$this->mfile->checkFilesExist($a_attachment)) {
1225 return [
new ilMailError(
'mail_attachment_file_not_exist', [$a_attachment])];
1228 $errors = $this->checkMail((
string) $a_rcp_to, (
string) $a_rcp_cc, (
string) $a_rcp_bcc, (
string) $a_m_subject);
1233 $errors = $this->validateRecipients((
string) $a_rcp_to, (
string) $a_rcp_cc, (
string) $a_rcp_bcc);
1238 $rcp_to = $a_rcp_to;
1239 $rcp_cc = $a_rcp_cc;
1240 $rcp_bcc = $a_rcp_bcc;
1242 if (
null === $rcp_cc) {
1246 if (
null === $rcp_bcc) {
1250 $numberOfExternalAddresses = $this->getCountRecipients($rcp_to, $rcp_cc, $rcp_bcc,
true);
1252 $numberOfExternalAddresses > 0 &&
1253 !$this->isSystemMail() &&
1254 !
$DIC->rbac()->system()->checkAccessOfUser($this->user_id,
'smtp_mail', $this->mail_obj_ref_id)
1256 return [
new ilMailError(
'mail_no_permissions_write_smtp')];
1259 if ($this->appendInstallationSignature()) {
1260 $a_m_message .= self::_getInstallationSignature();
1264 return $this->sendMail(
1268 (
string) $a_m_subject,
1269 (
string) $a_m_message,
1270 (array) $a_attachment,
1271 (
bool) $a_use_placeholders
1275 $taskFactory =
$DIC->backgroundTasks()->taskFactory();
1276 $taskManager =
$DIC->backgroundTasks()->taskManager();
1279 $bucket->setUserId($this->user_id);
1281 $task = $taskFactory->createTask(ilMailDeliveryJob::class, [
1282 (
int) $this->user_id,
1286 (
string) $a_m_subject,
1287 (
string) $a_m_message,
1288 (
string) serialize($a_attachment),
1289 (
bool) $a_use_placeholders,
1290 (
bool) $this->getSaveInSentbox(),
1291 (
string) $this->contextId,
1292 (
string) serialize($this->contextParameters)
1294 $interaction = $taskFactory->createTask(ilMailDeliveryJobUserInteraction::class, [
1296 (
int) $this->user_id
1299 $bucket->setTask($interaction);
1300 $bucket->setTitle($this->lng->txt(
'mail_bg_task_title'));
1301 $bucket->setDescription(sprintf($this->lng->txt(
'mail_bg_task_desc'), $a_m_subject));
1303 $this->logger->info(
'Delegated delivery to background task');
1304 $taskManager->run($bucket);
1330 bool $usePlaceholders
1332 $internalMessageId = $this->saveInSentbox(
1341 if (count($attachments) > 0) {
1342 $this->mfile->assignAttachmentsToDirectory($internalMessageId, $internalMessageId);
1343 $this->mfile->saveFiles($internalMessageId, $attachments);
1346 $numberOfExternalAddresses = $this->getCountRecipients($to, $cc, $bcc,
true);
1348 if ($numberOfExternalAddresses > 0) {
1349 $externalMailRecipientsTo = $this->getEmailRecipients($to);
1350 $externalMailRecipientsCc = $this->getEmailRecipients($cc);
1351 $externalMailRecipientsBcc = $this->getEmailRecipients($bcc);
1353 $this->logger->debug(
1354 "Parsed external email addresses from given recipients /" .
1355 " To: " . $externalMailRecipientsTo .
1356 " | CC: " . $externalMailRecipientsCc .
1357 " | BCC: " . $externalMailRecipientsBcc .
1358 " | Subject: " . $subject
1361 $this->sendMimeMail(
1362 $externalMailRecipientsTo,
1363 $externalMailRecipientsCc,
1364 $externalMailRecipientsBcc,
1366 $this->formatLinebreakMessage(
1367 $usePlaceholders ? $this->replacePlaceholders(
$message, 0,
false) :
$message
1372 $this->logger->debug(
'No external email addresses given in recipient string');
1377 if (!$this->distributeMail(
1390 if (!$this->getSaveInSentbox()) {
1391 $this->deleteMails([$internalMessageId]);
1415 return [
new ilMailError(
'mail_generic_rcp_error', [
$e->getMessage()])];
1439 return $this->sendInternalMail(
1440 $this->mailbox->getSentFolder(),
1466 $mailer->From($this->senderFactory->getSenderByUsrId((
int) $this->user_id));
1468 $mailer->Subject($subject,
true, (
string) ($this->contextParameters[self::PROP_CONTEXT_SUBJECT_PREFIX] ??
''));
1479 foreach ($attachments as $attachment) {
1481 $this->mfile->getAbsoluteAttachmentPoolPathByFilename($attachment),
1497 $this->table_mail_saved,
1499 'attachments' => [
'clob', serialize($attachments)]
1502 'user_id' => [
'integer', $this->user_id]
1515 if (strlen($addresses) > 0) {
1516 $this->logger->debug(sprintf(
1517 "Started parsing of recipient string: %s",
1522 $parser = $this->mailAddressParserFactory->getParser((
string) $addresses);
1523 $parsedAddresses = $parser->parse();
1525 if (strlen($addresses) > 0) {
1526 $this->logger->debug(sprintf(
1527 "Parsed addresses: %s",
1529 return (
string) $address;
1530 }, $parsedAddresses))
1534 return $parsedAddresses;
1545 if ($onlyExternalAddresses) {
1549 $this->usrIdByLoginCallable
1553 return count($addresses->value());
1564 string $toRecipients,
1565 string $ccRecipients,
1566 string $bccRecipients,
1567 $onlyExternalAddresses =
true
1570 $this->getCountRecipient($toRecipients, $onlyExternalAddresses) +
1571 $this->getCountRecipient($ccRecipients, $onlyExternalAddresses) +
1572 $this->getCountRecipient($bccRecipients, $onlyExternalAddresses)
1585 $this->usrIdByLoginCallable
1588 $emailRecipients = array_map(
function (
ilMailAddress $address) {
1589 return (
string) $address;
1590 }, $addresses->value());
1592 return implode(
',', $emailRecipients);
1608 $lang->loadLanguageModule(
'mail');
1611 $lang->txt(
'mail_auto_generated_info'),
1620 public static function _getIliasMailerName() : string
1623 $senderFactory =
$GLOBALS[
"DIC"][
"mail.mime.sender.factory"];
1625 return $senderFactory->system()->getFromName();
1634 if (
null === $a_flag) {
1635 return $this->appendInstallationSignature;
1638 $this->appendInstallationSignature = $a_flag;
1649 $signature =
$DIC->settings()->get(
'mail_system_sys_signature');
1653 if (is_array($clientdirs) && count($clientdirs) > 1) {
1654 $clientUrl .=
'/login.php?client_id=' .
CLIENT_ID;
1657 $signature = str_ireplace(
'[CLIENT_NAME]',
$DIC[
'ilClientIniFile']->
readVariable(
'client',
'name'), $signature);
1658 $signature = str_ireplace(
1663 $signature = str_ireplace(
'[CLIENT_URL]', $clientUrl, $signature);
1665 if (!preg_match(
'/^[\n\r]+/', $signature)) {
1666 $signature =
"\n" . $signature;
1682 $lang->loadLanguageModule(
'mail');
1685 $gender = $gender ? $gender :
'n';
1688 if (!strlen(
$name[
'firstname'])) {
1689 return $lang->txt(
'mail_salutation_anonymous') .
',';
1693 $lang->txt(
'mail_salutation_' . $gender) .
' ' .
1694 (
$name[
'title'] ?
$name[
'title'] .
' ' :
'') .
1695 (
$name[
'firstname'] ?
$name[
'firstname'] .
' ' :
'') .
1696 $name[
'lastname'] .
',';
1701 if (!array_key_exists($usrId, $this->userInstancesByIdMap)) {
1704 }
catch (Exception
$e) {
1708 $this->userInstancesByIdMap[$usrId] = $user;
1711 return $this->userInstancesByIdMap[$usrId];
1720 $this->userInstancesByIdMap = $userInstanceByIdMap;
1729 if (!isset($this->mailOptionsByUsrIdMap[$usrId])) {
1730 $this->mailOptionsByUsrIdMap[$usrId] =
new ilMailOptions($usrId);
1733 return $this->mailOptionsByUsrIdMap[$usrId];
1742 $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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
const PROP_CONTEXT_SUBJECT_PREFIX
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
foreach($_POST as $key=> $value) $res