19 declare(strict_types=1);
72 int $mailAdminNodeRefId = null,
79 $this->eventHandler = $eventHandler ?? $DIC->event();
80 $this->db = $db ?? $DIC->database();
81 $this->
lng = $lng ?? $DIC->language();
82 $this->actor = $actor ?? $DIC->user();
84 $this->mail_options = $mailOptions ??
new ilMailOptions($a_user_id);
85 $this->mailbox = $mailBox ??
new ilMailbox($a_user_id);
86 $this->senderFactory = $senderFactory ??
$GLOBALS[
"DIC"][
"mail.mime.sender.factory"];
90 $this->user_id = $a_user_id;
91 $this->mail_obj_ref_id = $mailAdminNodeRefId;
92 if (null === $this->mail_obj_ref_id) {
95 $this->
lng->loadLanguageModule(
'mail');
96 $this->table_mail =
'mail';
97 $this->table_mail_saved =
'mail_saved';
103 $clone = clone $this;
112 $clone = clone $this;
114 $clone->contextParameters = $parameters;
124 public function existsRecipient(
string $newRecipient,
string $existingRecipients): bool
131 $diffedAddresses = $list->value();
133 return count($diffedAddresses) === 0;
138 $this->save_in_sentbox = $saveInSentbox;
158 $recipients = trim($recipients);
159 if ($recipients ===
'') {
160 return $this->
lng->txt(
'not_available');
165 $recipients = array_filter(array_map(
'trim', explode(
',', $recipients)));
166 foreach ($recipients as $recipient) {
168 if (is_int($usrId) && $usrId > 0) {
170 if ($pp ===
'g' || ($pp ===
'y' && !$this->actor->isAnonymous())) {
173 $names[] = $user->getFullname() .
' [' . $recipient .
']';
179 $names[] = $recipient;
182 return implode(
', ', $names);
187 $this->db->setLimit(1, 0);
190 "SELECT b.* FROM $this->table_mail a",
191 "INNER JOIN $this->table_mail b ON b.folder_id = a.folder_id",
192 'AND b.user_id = a.user_id AND b.send_time > a.send_time',
193 'WHERE a.user_id = %s AND a.mail_id = %s ORDER BY b.send_time ASC',
195 $res = $this->db->queryF(
197 [
'integer',
'integer'],
198 [$this->user_id, $mailId]
208 $this->db->setLimit(1, 0);
211 "SELECT b.* FROM $this->table_mail a",
212 "INNER JOIN $this->table_mail b ON b.folder_id = a.folder_id",
213 'AND b.user_id = a.user_id AND b.send_time < a.send_time',
214 'WHERE a.user_id = %s AND a.mail_id = %s ORDER BY b.send_time DESC',
216 $res = $this->db->queryF(
218 [
'integer',
'integer'],
219 [$this->user_id, $mailId]
232 "SELECT sender_id, m_subject, mail_id, m_status, send_time, import_name " .
233 "FROM $this->table_mail " .
234 "LEFT JOIN object_data ON obj_id = sender_id " .
235 "WHERE user_id = %s AND folder_id = %s " .
236 "AND ((sender_id > 0 AND sender_id IS NOT NULL AND obj_id IS NOT NULL) " .
237 "OR (sender_id = 0 OR sender_id IS NULL))";
239 if (isset($filter[
'status']) && $filter[
'status'] !==
'') {
240 $query .=
' AND m_status = ' . $this->db->quote($filter[
'status'],
'text');
243 $query .=
" ORDER BY send_time DESC";
245 $res = $this->db->queryF(
247 [
'integer',
'integer'],
248 [$this->user_id, $a_folder_id]
251 while ($row = $this->db->fetchAssoc(
$res)) {
255 return array_filter($mails);
260 $res = $this->db->queryF(
261 "SELECT COUNT(*) FROM $this->table_mail WHERE user_id = %s AND folder_id = %s",
262 [
'integer',
'integer'],
263 [$this->user_id, $folderId]
266 return $this->db->numRows(
$res);
272 foreach ($mails as $mail_data) {
279 $res = $this->db->queryF(
280 "SELECT * FROM $this->table_mail WHERE user_id = %s AND mail_id = %s",
281 [
'integer',
'integer'],
282 [$this->user_id, $mailId]
298 $query =
"UPDATE $this->table_mail SET m_status = %s WHERE user_id = %s ";
299 array_push($types,
'text',
'integer');
300 array_push($values,
'read', $this->user_id);
302 if (count($mailIds) > 0) {
303 $query .=
' AND ' . $this->db->in(
'mail_id', $mailIds,
false,
'integer');
306 $this->db->manipulateF(
$query, $types, $values);
317 $query =
"UPDATE $this->table_mail SET m_status = %s WHERE user_id = %s ";
318 array_push($types,
'text',
'integer');
319 array_push($values,
'unread', $this->user_id);
321 if (count($mailIds) > 0) {
322 $query .=
' AND ' . $this->db->in(
'mail_id', $mailIds,
false,
'integer');
325 $this->db->manipulateF(
$query, $types, $values);
338 $mailIds = array_filter(array_map(
'intval', $mailIds));
340 if (0 === count($mailIds)) {
345 "UPDATE $this->table_mail " .
346 "INNER JOIN mail_obj_data " .
347 "ON mail_obj_data.obj_id = %s AND mail_obj_data.user_id = %s " .
348 "SET $this->table_mail.folder_id = mail_obj_data.obj_id " .
349 "WHERE $this->table_mail.user_id = %s";
350 array_push($types,
'integer',
'integer',
'integer');
351 array_push($values, $folderId, $this->user_id, $this->user_id);
353 $query .=
' AND ' . $this->db->in(
'mail_id', $mailIds,
false,
'integer');
355 $affectedRows = $this->db->manipulateF(
$query, $types, $values);
357 return $affectedRows > 0;
365 $mailIds = array_filter(array_map(
'intval', $mailIds));
366 foreach ($mailIds as
$id) {
367 $this->db->manipulateF(
368 "DELETE FROM $this->table_mail WHERE user_id = %s AND mail_id = %s",
369 [
'integer',
'integer'],
370 [$this->user_id, $id]
372 $this->mfile->deassignAttachmentFromDirectory($id);
382 if (!is_array($row) || empty($row)) {
386 if (isset($row[
'attachments'])) {
387 $unserialized = unserialize(stripslashes($row[
'attachments']), [
'allowed_classes' =>
false]);
388 $row[
'attachments'] = is_array($unserialized) ? $unserialized : [];
390 $row[
'attachments'] = [];
393 if (isset($row[
'tpl_ctx_params']) && is_string($row[
'tpl_ctx_params'])) {
394 $decoded = json_decode($row[
'tpl_ctx_params'],
true, 512, JSON_THROW_ON_ERROR);
395 $row[
'tpl_ctx_params'] = (array) ($decoded ?? []);
397 $row[
'tpl_ctx_params'] = [];
400 if (isset($row[
'mail_id'])) {
401 $row[
'mail_id'] = (
int) $row[
'mail_id'];
404 if (isset($row[
'user_id'])) {
405 $row[
'user_id'] = (
int) $row[
'user_id'];
408 if (isset($row[
'folder_id'])) {
409 $row[
'folder_id'] = (
int) $row[
'folder_id'];
412 if (isset($row[
'sender_id'])) {
413 $row[
'sender_id'] = (
int) $row[
'sender_id'];
416 if (isset($row[
'use_placeholders'])) {
417 $row[
'use_placeholders'] = (bool) $row[
'use_placeholders'];
420 $null_to_string_properties = [
'm_subject',
'm_message',
'rcp_to',
'rcp_cc',
'rcp_bcc'];
421 foreach ($null_to_string_properties as $null_to_string_property) {
422 if (!isset($row[$null_to_string_property])) {
423 $row[$null_to_string_property] =
'';
432 $nextId = $this->db->nextId($this->table_mail);
433 $this->db->insert($this->table_mail, [
434 'mail_id' => [
'integer', $nextId],
435 'user_id' => [
'integer', $this->user_id],
436 'folder_id' => [
'integer', $folderId],
437 'sender_id' => [
'integer', $this->user_id],
459 array $a_attachments,
466 bool $a_use_placeholders =
false,
467 ?
string $a_tpl_context_id = null,
468 array $a_tpl_context_params = []
473 'folder_id' => [
'integer', $a_folder_id],
474 'attachments' => [
'clob', serialize($a_attachments)],
475 'send_time' => [
'timestamp', date(
'Y-m-d H:i:s')],
476 'rcp_to' => [
'clob', $a_rcp_to],
477 'rcp_cc' => [
'clob', $a_rcp_cc],
478 'rcp_bcc' => [
'clob', $a_rcp_bcc],
479 'm_status' => [
'text',
'read'],
480 'm_subject' => [
'text', $a_m_subject],
481 'm_message' => [
'clob', $a_m_message],
482 'use_placeholders' => [
'integer', (
int) $a_use_placeholders],
483 'tpl_ctx_id' => [
'text', $a_tpl_context_id],
484 'tpl_ctx_params' => [
'blob', json_encode($a_tpl_context_params, JSON_THROW_ON_ERROR)],
487 'mail_id' => [
'integer', $a_draft_id],
505 bool $usePlaceholders =
false,
506 ?
string $templateContextId = null,
507 array $templateContextParameters = []
511 if ($usePlaceholders) {
515 $message = str_ireplace([
"<br />",
"<br>",
"<br/>"],
"\n", $message);
517 $nextId = $this->db->nextId($this->table_mail);
518 $this->db->insert($this->table_mail, [
519 'mail_id' => [
'integer', $nextId],
520 'user_id' => [
'integer', $usrId],
521 'folder_id' => [
'integer', $folderId],
522 'sender_id' => [
'integer', $senderUsrId],
523 'attachments' => [
'clob', serialize($attachments)],
524 'send_time' => [
'timestamp', date(
'Y-m-d H:i:s')],
525 'rcp_to' => [
'clob', $to],
526 'rcp_cc' => [
'clob', $cc],
527 'rcp_bcc' => [
'clob', $bcc],
528 'm_status' => [
'text', $status],
529 'm_subject' => [
'text', $subject],
530 'm_message' => [
'clob', $message],
531 'tpl_ctx_id' => [
'text', $templateContextId],
532 'tpl_ctx_params' => [
'blob', json_encode($templateContextParameters, JSON_THROW_ON_ERROR)],
535 $sender_equals_reveiver = $usrId === $this->mailbox->getUsrId();
536 $is_sent_folder_of_sender =
false;
537 if ($sender_equals_reveiver) {
539 $is_sent_folder_of_sender = $folderId === $current_folder_id;
542 $raise_event = !$sender_equals_reveiver || !$is_sent_folder_of_sender;
545 $this->eventHandler->raise(
'Services/Mail',
'sentInternalMail', [
547 'subject' => $subject,
548 'body' => (
string) $message,
549 'from_usr_id' => $senderUsrId,
550 'to_usr_id' => $usrId,
563 bool $replaceEmptyPlaceholders =
true 566 if ($this->contextId) {
574 $message = $processor->resolve($user, $this->contextParameters, $replaceEmptyPlaceholders);
576 $this->
logger->error(__METHOD__ .
' has been called with invalid context. ' . $e->getMessage());
601 bool $usePlaceholders =
false 603 if ($usePlaceholders) {
605 $this->
logger->debug(sprintf(
606 "Parsed TO user ids from given recipients for serial letter notification: %s",
607 implode(
', ', $toUsrIds)
622 $otherUsrIds = $this->
getUserIds([$cc, $bcc]);
623 $this->
logger->debug(sprintf(
624 "Parsed CC/BCC user ids from given recipients for serial letter notification: %s",
625 implode(
', ', $otherUsrIds)
639 $usrIds = $this->
getUserIds([$to, $cc, $bcc]);
640 $this->
logger->debug(sprintf(
641 "Parsed TO/CC/BCC user ids from given recipients: %s",
642 implode(
', ', $usrIds)
680 bool $usePlaceholders =
false 682 $usrIdToExternalEmailAddressesMap = [];
683 $usrIdToMessageMap = [];
685 foreach ($usrIds as $usrId) {
688 $this->
logger->critical(sprintf(
689 "Skipped recipient with id %s (User not found)",
697 $canReadInternalMails = !$user->hasToAcceptTermsOfService() && $user->checkTimeLimit();
700 $this->
logger->debug(sprintf(
701 "Skipped recipient with id %s (Accepted User Agreement:%s|Expired Account:%s)",
703 var_export(!$user->hasToAcceptTermsOfService(),
true),
704 var_export(!$user->checkTimeLimit(),
true)
710 if ($usePlaceholders) {
712 $usrIdToMessageMap[$user->getId()] = $individualMessage;
715 if ($user->getActive()) {
716 $wantsToReceiveExternalEmail = (
721 if (!$canReadInternalMails || $wantsToReceiveExternalEmail) {
722 $emailAddresses = $mailOptions->getExternalEmailAddresses();
723 $usrIdToExternalEmailAddressesMap[$user->getId()] = $emailAddresses;
726 $this->
logger->debug(sprintf(
727 "Recipient with id %s will only receive external emails sent to: %s",
729 implode(
', ', $emailAddresses)
734 $this->
logger->debug(sprintf(
735 "Recipient with id %s will additionally receive external emails " .
736 "(because the user wants to receive it externally, or the user cannot access " .
737 "the internal mail system) sent to: %s",
739 implode(
', ', $emailAddresses)
742 $this->
logger->debug(sprintf(
743 "Recipient with id %s is does not want to receive external emails",
748 $this->
logger->debug(sprintf(
749 "Recipient with id %s is inactive and will not receive external emails",
756 $recipientInboxId = $mbox->getInboxFolder();
771 if (count($attachments) > 0) {
772 $this->mfile->assignAttachmentsToDirectory($internalMailId, $sentMailId);
781 $usrIdToExternalEmailAddressesMap,
798 bool $usePlaceholders,
799 array $usrIdToExternalEmailAddressesMap,
800 array $usrIdToMessageMap
802 if (1 === count($usrIdToExternalEmailAddressesMap)) {
803 if ($usePlaceholders) {
804 $message = array_values($usrIdToMessageMap)[0];
807 $usrIdToExternalEmailAddressesMap = array_values($usrIdToExternalEmailAddressesMap);
808 $firstAddresses = current($usrIdToExternalEmailAddressesMap);
811 implode(
',', $firstAddresses),
818 } elseif (count($usrIdToExternalEmailAddressesMap) > 1) {
819 if ($usePlaceholders) {
820 foreach ($usrIdToExternalEmailAddressesMap as $usrId => $addresses) {
821 if (0 === count($addresses)) {
826 implode(
',', $addresses),
836 $usrIdToExternalEmailAddressesMap
839 $flattenEmailAddresses = array_unique($flattenEmailAddresses);
842 $remainingAddresses =
'';
843 foreach ($flattenEmailAddresses as $emailAddress) {
845 if ($remainingAddresses !==
'') {
851 if ($recipientsLineLength >= $this->maxRecipientCharacterLength) {
861 $remainingAddresses =
'';
865 $remainingAddresses .= ($sep . $emailAddress);
868 if (
'' !== $remainingAddresses) {
888 $parsed_usr_ids = [];
890 $joined_recipients = implode(
',', array_filter(array_map(
'trim', $recipients)));
893 foreach ($addresses as $address) {
894 $address_type = $this->mailAddressTypeFactory->getByPrefix($address);
895 $parsed_usr_ids[] = $address_type->resolve();
898 return array_unique(array_merge(...$parsed_usr_ids));
908 protected function checkMail(
string $to,
string $cc,
string $bcc,
string $subject): array
913 $subject =>
'mail_add_subject',
914 $to =>
'mail_add_recipient',
916 foreach ($checks as $string => $error) {
917 if ($string ===
'') {
941 foreach ($addresses as $address) {
942 $address_type = $this->mailAddressTypeFactory->getByPrefix($address);
943 if (!$address_type->validate($this->user_id)) {
944 $errors[] = $address_type->getErrors();
948 $colonPosition = strpos($e->getMessage(),
':');
950 ($colonPosition ===
false) ?
952 substr($e->getMessage(), $colonPosition + 2)
956 return array_merge(...
$errors);
974 array $a_attachments,
980 bool $a_use_placeholders =
false,
981 ?
string $a_tpl_context_id = null,
982 ?array $a_tpl_ctx_params = []
985 $this->table_mail_saved,
987 'user_id' => [
'integer', $this->user_id],
990 'attachments' => [
'clob', serialize($a_attachments)],
991 'rcp_to' => [
'clob', $a_rcp_to],
992 'rcp_cc' => [
'clob', $a_rcp_cc],
993 'rcp_bcc' => [
'clob', $a_rcp_bcc],
994 'm_subject' => [
'text', $a_m_subject],
995 'm_message' => [
'clob', $a_m_message],
996 'use_placeholders' => [
'integer', (
int) $a_use_placeholders],
997 'tpl_ctx_id' => [
'text', $a_tpl_context_id],
998 'tpl_ctx_params' => [
'blob', json_encode((array) $a_tpl_ctx_params, JSON_THROW_ON_ERROR)],
1009 $res = $this->db->queryF(
1010 "SELECT * FROM $this->table_mail_saved WHERE user_id = %s",
1016 if (!is_array($this->mail_data)) {
1017 $this->
persistToStage($this->user_id, [],
'',
'',
'',
'',
'',
false);
1038 string $a_m_subject,
1039 string $a_m_message,
1040 array $a_attachment,
1041 bool $a_use_placeholders =
false 1046 "New mail system task:" .
1047 " To: " . $a_rcp_to .
1048 " | CC: " . $a_rcp_cc .
1049 " | BCC: " . $a_rcp_bcc .
1050 " | Subject: " . $a_m_subject .
1051 " | Attachments: " . print_r($a_attachment,
true)
1054 if ($a_attachment && !$this->mfile->checkFilesExist($a_attachment)) {
1055 return [
new ilMailError(
'mail_attachment_file_not_exist', [$a_attachment])];
1058 $errors = $this->
checkMail($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject);
1068 $rcp_to = $a_rcp_to;
1069 $rcp_cc = $a_rcp_cc;
1070 $rcp_bcc = $a_rcp_bcc;
1074 $numberOfExternalAddresses > 0 &&
1076 !$DIC->rbac()->system()->checkAccessOfUser($this->user_id,
'smtp_mail', $this->mail_obj_ref_id)
1078 return [
new ilMailError(
'mail_no_permissions_write_smtp')];
1082 $a_m_message .= self::_getInstallationSignature();
1097 $taskFactory = $DIC->backgroundTasks()->taskFactory();
1098 $taskManager = $DIC->backgroundTasks()->taskManager();
1101 $bucket->setUserId($this->user_id);
1103 $task = $taskFactory->createTask(ilMailDeliveryJob::class, [
1110 serialize($a_attachment),
1111 $a_use_placeholders,
1113 (
string) $this->contextId,
1114 serialize($this->contextParameters),
1116 $interaction = $taskFactory->createTask(ilMailDeliveryJobUserInteraction::class, [
1121 $bucket->setTask($interaction);
1122 $bucket->setTitle($this->
lng->txt(
'mail_bg_task_title'));
1123 $bucket->setDescription(sprintf($this->
lng->txt(
'mail_bg_task_desc'), $a_m_subject));
1125 $this->
logger->info(
'Delegated delivery to background task');
1126 $taskManager->run($bucket);
1152 bool $usePlaceholders
1163 if (count($attachments) > 0) {
1164 $this->mfile->assignAttachmentsToDirectory($internalMessageId, $internalMessageId);
1165 $this->mfile->saveFiles($internalMessageId, $attachments);
1170 if ($numberOfExternalAddresses > 0) {
1176 "Parsed external email addresses from given recipients /" .
1177 " To: " . $externalMailRecipientsTo .
1178 " | CC: " . $externalMailRecipientsCc .
1179 " | BCC: " . $externalMailRecipientsBcc .
1180 " | Subject: " . $subject
1184 $externalMailRecipientsTo,
1185 $externalMailRecipientsCc,
1186 $externalMailRecipientsBcc,
1196 $this->
logger->debug(
'No external email addresses given in recipient string');
1220 if ($random->int(0, 50) === 2) {
1249 return [
new ilMailError(
'mail_generic_rcp_error', [$e->getMessage()])];
1257 $send_folder_id = 0;
1259 $send_folder_id = $this->mailbox->getSentFolder();
1262 return $send_folder_id;
1313 $mailer->From($this->senderFactory->getSenderByUsrId($this->user_id));
1318 (
string) ($this->contextParameters[self::PROP_CONTEXT_SUBJECT_PREFIX] ??
'')
1320 $mailer->Body($message);
1330 foreach ($attachments as $attachment) {
1332 $this->mfile->getAbsoluteAttachmentPoolPathByFilename($attachment),
1348 $this->table_mail_saved,
1350 'attachments' => [
'clob', serialize($attachments)],
1353 'user_id' => [
'integer', $this->user_id],
1365 if ($addresses !==
'') {
1366 $this->
logger->debug(sprintf(
1367 "Started parsing of recipient string: %s",
1372 $parser = $this->mailAddressParserFactory->getParser($addresses);
1373 $parsedAddresses = $parser->parse();
1375 if ($addresses !==
'') {
1376 $this->
logger->debug(sprintf(
1377 "Parsed addresses: %s",
1378 implode(
',', array_map(
static function (
ilMailAddress $address):
string {
1379 return (
string) $address;
1380 }, $parsedAddresses))
1384 return $parsedAddresses;
1390 if ($onlyExternalAddresses) {
1394 $this->usrIdByLoginCallable
1398 return count($addresses->value());
1402 string $toRecipients,
1403 string $ccRecipients,
1404 string $bccRecipients,
1405 bool $onlyExternalAddresses =
true 1419 $this->usrIdByLoginCallable
1422 $emailRecipients = array_map(
static function (
ilMailAddress $address):
string {
1423 return (
string) $address;
1424 }, $addresses->value());
1426 return implode(
',', $emailRecipients);
1437 $lang->loadLanguageModule(
'mail');
1440 $lang->txt(
'mail_auto_generated_info'),
1446 public static function _getIliasMailerName():
string 1449 $senderFactory =
$GLOBALS[
"DIC"][
"mail.mime.sender.factory"];
1451 return $senderFactory->
system()->getFromName();
1460 if (null === $a_flag) {
1472 $signature = $DIC->settings()->get(
'mail_system_sys_signature',
'');
1476 if (is_array($clientdirs) && count($clientdirs) > 1) {
1477 $clientUrl .=
'/login.php?client_id=' .
CLIENT_ID;
1480 $signature = str_ireplace(
1481 '[INSTALLATION_NAME]',
1482 $DIC[
'ilClientIniFile']->readVariable(
'client',
'name'),
1485 $signature = str_ireplace(
1486 '[INSTALLATION_DESC]',
1487 $DIC[
'ilClientIniFile']->readVariable(
'client',
'description'),
1490 $signature = str_ireplace(
'[ILIAS_URL]', $clientUrl, $signature);
1492 if (!preg_match(
'/^[\n\r]+/', $signature)) {
1493 $signature =
"\n" . $signature;
1503 $lang = ($a_language instanceof
ilLanguage) ? $a_language : $DIC->language();
1504 $lang->loadLanguageModule(
'mail');
1507 $gender = $gender ?:
'n';
1510 if (
$name[
'firstname'] ===
'') {
1511 return $lang->txt(
'mail_salutation_anonymous') .
',';
1515 $lang->txt(
'mail_salutation_' . $gender) .
' ' .
1516 (
$name[
'title'] ?
$name[
'title'] .
' ' :
'') .
1517 (
$name[
'firstname'] ?
$name[
'firstname'] .
' ' :
'') .
1518 $name[
'lastname'] .
',';
1523 if (!array_key_exists($usrId, $this->userInstancesByIdMap)) {
1530 $this->userInstancesByIdMap[$usrId] = $user;
1533 return $this->userInstancesByIdMap[$usrId];
1541 $this->userInstancesByIdMap = $userInstanceByIdMap;
1546 if (!isset($this->mailOptionsByUsrIdMap[$usrId])) {
1547 $this->mailOptionsByUsrIdMap[$usrId] =
new ilMailOptions($usrId);
1550 return $this->mailOptionsByUsrIdMap[$usrId];
setSaveInSentbox(bool $saveInSentbox)
ilMailMimeSenderFactory $senderFactory
formatLinebreakMessage(string $message)
Class ilMailOptions this class handles user mails.
getEmailRecipients(string $recipients)
persistToStage(int $a_user_id, array $a_attachments, string $a_rcp_to, string $a_rcp_cc, string $a_rcp_bcc, string $a_m_subject, string $a_m_message, bool $a_use_placeholders=false, ?string $a_tpl_context_id=null, ?array $a_tpl_ctx_params=[])
Class ilMailMimeSenderFactory.
__construct(int $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, ilObjUser $actor=null)
countMailsOfFolder(int $folderId)
static getLogger(string $a_component_id)
Get component logger.
int $maxRecipientCharacterLength
const ILIAS_VERSION_NUMERIC
markUnread(array $mailIds)
delegateExternalEmails(string $subject, string $message, array $attachments, bool $usePlaceholders, array $usrIdToExternalEmailAddressesMap, array $usrIdToMessageMap)
This class handles all operations on files (attachments) in directory ilias_data/mail.
appendInstallationSignature(bool $a_flag=null)
checkMail(string $to, string $cc, string $bcc, string $subject)
existsRecipient(string $newRecipient, string $existingRecipients)
getCountRecipients(string $toRecipients, string $ccRecipients, string $bccRecipients, bool $onlyExternalAddresses=true)
getMailsOfFolder(int $a_folder_id, array $filter=[])
const PROP_CONTEXT_SUBJECT_PREFIX
sendMimeMail(string $to, string $cc, string $bcc, string $subject, string $message, array $attachments)
enqueue(string $a_rcp_to, string $a_rcp_cc, string $a_rcp_bcc, string $a_m_subject, string $a_m_message, array $a_attachment, bool $a_use_placeholders=false)
Should be used to enqueue a 'mail'.
getUserInstanceById(int $usrId)
static _lookupName(int $a_user_id)
lookup user name
static _lookupId($a_user_str)
Class ilMailOnlyExternalAddressList.
ilAppEventHandler $eventHandler
deleteMailsOfFolder(int $folderId)
static _lookupPref(int $a_usr_id, string $a_keyword)
saveInSentbox(array $attachment, string $to, string $cc, string $bcc, string $subject, string $message)
getPreviousMail(int $mailId)
static _lookupGender(int $a_user_id)
Class ilMailDiffAddressList.
getCountRecipient(string $recipients, bool $onlyExternalAddresses=true)
static getTemplateContextById(string $a_id)
withContextParameters(array $parameters)
saveAttachments(array $attachments)
static strLen(string $a_string)
Class ilMailRfc822AddressParserFactory.
bool $appendInstallationSignature
fetchMailData(?array $row)
withContextId(string $contextId)
Mail Box class Base class for creating and handling mail boxes.
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
checkRecipients(string $recipients)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
getMailOptionsByUserId(int $usrId)
ilMailRfc822AddressParserFactory $mailAddressParserFactory
setUserInstanceById(array $userInstanceByIdMap)
ilMailOptions $mail_options
static _getLanguage(string $a_lang_key='')
Get language object.
Class ilMailTemplatePlaceholderResolver.
getMailObjectReferenceId()
distributeMail(string $to, string $cc, string $bcc, string $subject, string $message, array $attachments, int $sentMailId, bool $usePlaceholders=false)
validateRecipients(string $to, string $cc, string $bcc)
getNewDraftId(int $folderId)
ilMailAddressTypeFactory $mailAddressTypeFactory
formatNamesForOutput(string $recipients)
deleteMails(array $mailIds)
Wrapper for generation of random numbers, strings, bytes.
static _getAutoGeneratedMessageString(ilLanguage $lang=null)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static getMailObjectRefId()
array $mailOptionsByUsrIdMap
setMailOptionsByUserIdMap(array $mailOptionsByUsrIdMap)
sendInternalMail(int $folderId, int $senderUsrId, array $attachments, string $to, string $cc, string $bcc, string $status, string $subject, string $message, int $usrId=0, bool $usePlaceholders=false, ?string $templateContextId=null, array $templateContextParameters=[])
sendChanneledMails(string $to, string $cc, string $bcc, array $usrIds, string $subject, string $message, array $attachments, int $sentMailId, bool $usePlaceholders=false)
getUserIds(array $recipients)
static getType()
Get context type.
replacePlaceholders(string $message, int $usrId=0, bool $replaceEmptyPlaceholders=true)
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...
parseAddresses(string $addresses)
Explode recipient string, allowed separators are ',' ';' ' '.
Class ilMailAddressTypeFactory.
updateDraft(int $a_folder_id, array $a_attachments, string $a_rcp_to, string $a_rcp_cc, string $a_rcp_bcc, string $a_m_subject, string $a_m_message, int $a_draft_id=0, bool $a_use_placeholders=false, ?string $a_tpl_context_id=null, array $a_tpl_context_params=[])
moveMailsToFolder(array $mailIds, int $folderId)
readMailObjectReferenceId()
static _getInstallationSignature()
array $userInstancesByIdMap
Class ilMailAddressListImpl.