ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilMailCronOrphanedMailsNotification.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Mail/classes/class.ilMimeMailNotification.php';
5 include_once './Services/Mail/classes/class.ilMimeMail.php';
6 
12 {
16  public function __construct($a_is_personal_workspace = false)
17  {
18  parent::__construct($a_is_personal_workspace);
19  }
20 
24  protected function initLanguageByIso2Code($a_code = '')
25  {
26  parent::initLanguageByIso2Code($a_code);
27  $this->getLanguage()->loadLanguageModule('user');
28  }
29 
33  public function send()
34  {
35  foreach ($this->getRecipients() as $rcp) {
36  try {
37  $this->handleCurrentRecipient($rcp);
38  } catch (ilMailException $e) {
39  continue;
40  }
41  $this->initMimeMail();
42  $this->initLanguageByIso2Code();
43  $this->setSubject($this->getLanguage()->txt('orphaned_mail_subject'));
44 
45  $this->appendBody(ilMail::getSalutation($rcp));
46  $this->appendBody("\n\n");
47  $this->appendBody($this->getLanguage()->txt('orphaned_mail_body'));
48  $this->appendBody("\n\n");
49 
50  $body = $this->getOrphandMailsBody();
51  $this->appendBody($body);
53  $this->sendMimeMail($this->getCurrentRecipient());
54  }
55  }
56 
57  public function getOrphandMailsBody()
58  {
59  $additional_information = $this->getAdditionalInformation();
60  $mail_folders = $additional_information['mail_folders'];
61 
62  foreach ($mail_folders as $folder_object) {
63  $folder_title = $this->getLanguage()->txt('mail_' . $folder_object->getFolderTitle());
64  $this->appendBody($folder_title . ':');
65  $this->appendBody("\n");
66  foreach ($folder_object->getOrphanedMailObjects() as $mail_object) {
67  $this->appendBody($mail_object->getMailSubject());
68  $this->appendBody("\n");
69  }
70  }
71  }
72 }
Class ilMailException.
getRecipients()
get array of recipients
Base class for mime mail notifications.
appendBody($a_body)
Append body text.
static _getInstallationSignature()
static getSalutation($a_usr_id, ilLanguage $a_language=null)