ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
37  try
38  {
39  $this->handleCurrentRecipient($rcp);
40  }
41  catch(ilMailException $e)
42  {
43  continue;
44  }
45  $this->initMimeMail();
46  $this->initLanguageByIso2Code();
47  $this->setSubject($this->getLanguage()->txt('orphaned_mail_subject'));
48 
49  $this->appendBody(ilMail::getSalutation($rcp));
50  $this->appendBody("\n\n");
51  $this->appendBody($this->getLanguage()->txt('orphaned_mail_body'));
52  $this->appendBody("\n\n");
53 
54  $body = $this->getOrphandMailsBody();
55  $this->appendBody($body);
56  $this->appendBody(ilMail::_getInstallationSignature());
57  $this->sendMimeMail($this->getCurrentRecipient());
58  }
59  }
60 
61  public function getOrphandMailsBody()
62  {
63  $additional_information = $this->getAdditionalInformation();
64  $mail_folders = $additional_information['mail_folders'];
65 
66  foreach($mail_folders as $folder_object)
67  {
68  $folder_title = $this->getLanguage()->txt('mail_'.$folder_object->getFolderTitle());
69  $this->appendBody($folder_title.':');
70  $this->appendBody("\n");
71  foreach($folder_object->getOrphanedMailObjects() as $mail_object)
72  {
73  $this->appendBody($mail_object->getMailSubject());
74  $this->appendBody("\n");
75  }
76  }
77  }
78 }
Class ilMailException.
getRecipients()
get array of recipients
Base class for mime mail notifications.
appendBody($a_body)
Append body text.