43 : void
44 {
45 $is_message_enabled = (bool) $this->
settings->get(
"mail_notification_message",
'0');
46
47 $res = $this->db->queryF(
48 'SELECT mail.* FROM mail_options
49 INNER JOIN mail ON mail.user_id = mail_options.user_id
50 INNER JOIN mail_obj_data ON mail_obj_data.obj_id = mail.folder_id
51 INNER JOIN usr_data ud ON ud.usr_id = mail.user_id
52 WHERE mail_options.cronjob_notification = %s
53 AND mail.send_time >= %s
54 AND mail.m_status = %s
55 AND ud.active = %s',
56 ['integer', 'timestamp', 'text', 'integer'],
57 [1, date('Y-m-d H:i:s', time() - 60 * 60 * 24), 'unread', 1]
58 );
59
60 $users = [];
61 $user_id = 0;
62
63 while ($row = $this->db->fetchAssoc(
$res)) {
64 if ($user_id === 0 || (int) $row['user_id'] !== $user_id) {
65 $user_id = (
int) $row[
'user_id'];
66 }
67 $users[$user_id][] = $row;
68 }
69 $sender = $this->senderFactory->system();
70
71 foreach ($users as $user_id => $mail_data) {
74
76
79
82 if (count($mail_data) === 1) {
84 $user_lang->txt('mail_at_the_ilias_installation'),
85 count($mail_data),
87 ));
88 } else {
90 $user_lang->txt('mails_at_the_ilias_installation'),
91 count($mail_data),
93 ));
94 }
96
97 $counter = 1;
98 foreach ($mail_data as
$mail) {
99 $this->
appendBody(
"----------------------------------------------------------------------------------------------");
102 $this->
appendBody($user_lang->txt(
'date') .
": " .
$mail[
'send_time']);
105 $senderName = ilMail::_getIliasMailerName();
106 } else {
108 }
109 $this->
appendBody($user_lang->txt(
'sender') .
": " . $senderName);
111 $this->
appendBody($user_lang->txt(
'subject') .
": " .
$mail[
'm_subject']);
113
114 if ($is_message_enabled) {
115 $this->
appendBody($user_lang->txt(
'message') .
": " .
$mail[
'm_message']);
117 }
118 ++$counter;
119 }
120 $this->
appendBody(
"----------------------------------------------------------------------------------------------");
122 $this->
appendBody($user_lang->txt(
'follow_link_to_read_mails') .
" ");
125 $mailbox_link .=
"/goto.php?target=mail&client_id=" .
CLIENT_ID;
126
131
134
136 $mmail->To($mailOptions->getExternalEmailAddresses());
137
139 $mmail->Body($this->
getBody());
140 $mmail->Send();
141 }
142 }
getLanguageText(string $a_keyword)
setRecipients(array $a_rcp)
appendBody(string $a_body)
setSubject(string $a_subject)
initLanguage(int $a_usr_id)
Class ilMailOptions this class handles user mails.
static _getAutoGeneratedMessageString(ilLanguage $lang=null)
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
static _getInstallationSignature()
static _lookupLogin(int $a_user_id)