ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilFormatMail Class Reference

Class UserMail this class handles user mails. More...

+ Inheritance diagram for ilFormatMail:
+ Collaboration diagram for ilFormatMail:

Public Member Functions

 __construct ($a_user_id)
 Constructor setup an mail object. More...
 
 formatReplyMessage ()
 format a reply message public More...
 
 formatReplySubject ()
 format a reply subject public More...
 
 formatReplyRecipientsForCC ()
 get reply recipients for cc public More...
 
 formatReplyRecipient ()
 get reply recipient public More...
 
 formatForwardSubject ()
 format a forward subject public More...
 
 appendSearchResult ($a_names, $a_type)
 append search result to recipient public More...
 
 formatLinebreakMessage (string $message)
 
 appendSignature ()
 append signature to mail body public More...
 
 prependSignature ()
 
- Public Member Functions inherited from ilMail
 __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)
 
 withContextId (string $contextId)
 
 withContextParameters (array $parameters)
 
 existsRecipient (string $newRecipient, string $existingRecipients)
 
 setSaveInSentbox (bool $saveInSentbox)
 
 getSaveInSentbox ()
 
 getMailObjectReferenceId ()
 
 formatNamesForOutput (string $recipients)
 Prepends the full name of each ILIAS login name (if user has a public profile) found in the passed string and brackets the ILIAS login name afterwards. More...
 
 getPreviousMail (int $mailId)
 
 getNextMail (int $mailId)
 
 getMailsOfFolder ($a_folder_id, $filter=[])
 
 countMailsOfFolder (int $folderId)
 
 deleteMailsOfFolder (int $folderId)
 
 getMail (int $mailId)
 
 markRead (array $mailIds)
 
 markUnread (array $mailIds)
 
 moveMailsToFolder (array $mailIds, int $folderId)
 
 deleteMails (array $mailIds)
 
 getNewDraftId (int $usrId, int $folderId)
 
 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=[])
 
 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 public More...
 
 getSavedData ()
 
 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'. More...
 
 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 consumer, please use ::enqueue. More...
 
 validateRecipients (string $to, string $cc, string $bcc)
 
 saveAttachments (array $attachments)
 
 appendInstallationSignature (bool $a_flag=null)
 
 setUserInstanceById (array $userInstanceByIdMap)
 
 setMailOptionsByUserIdMap (array $mailOptionsByUsrIdMap)
 
 formatLinebreakMessage (string $message)
 

Additional Inherited Members

- Static Public Member Functions inherited from ilMail
static _getAutoGeneratedMessageString (ilLanguage $lang=null)
 Get auto generated info string. More...
 
static _getInstallationSignature ()
 
static getSalutation ($a_usr_id, ilLanguage $a_language=null)
 
- Data Fields inherited from ilMail
const ILIAS_HOST = 'ilias'
 
 $user_id
 
- Protected Member Functions inherited from ilMail
 isSystemMail ()
 
 readMailObjectReferenceId ()
 Read and set the mail object ref id (administration node) More...
 
 fetchMailData (?array $row)
 
 replacePlaceholders (string $message, int $usrId=0, bool $replaceEmptyPlaceholders=true)
 
 distributeMail (string $to, string $cc, string $bcc, string $subject, string $message, array $attachments, int $sentMailId, bool $usePlaceholders=false)
 
 sendChanneledMails (string $to, string $cc, string $bcc, array $usrIds, string $subject, string $message, array $attachments, int $sentMailId, bool $usePlaceholders=false)
 
 delegateExternalEmails (string $subject, string $message, array $attachments, bool $usePlaceholders, array $usrIdToExternalEmailAddressesMap, array $usrIdToMessageMap)
 
 getUserIds (array $recipients)
 
 checkMail (string $to, string $cc, string $bcc, string $subject)
 
 checkRecipients (string $recipients)
 Check if recipients are valid. More...
 
 saveInSentbox (array $attachment, string $to, string $cc, string $bcc, string $subject, string $message)
 Stores a message in the sent bod of the current user. More...
 
 parseAddresses ($addresses)
 Explode recipient string, allowed separators are ',' ';' ' ' Returns an array with recipient ilMailAddress instances. More...
 
 getCountRecipient (string $recipients, $onlyExternalAddresses=true)
 
 getCountRecipients (string $toRecipients, string $ccRecipients, string $bccRecipients, $onlyExternalAddresses=true)
 
 getEmailRecipients (string $recipients)
 
 getUserInstanceById (int $usrId)
 
 getMailOptionsByUserId (int $usrId)
 
- Protected Attributes inherited from ilMail
 $lng
 
 $db
 
 $mfile
 
 $mail_options
 
 $mailbox
 
 $table_mail
 
 $table_mail_saved
 
 $mail_data = array()
 
 $mail_obj_ref_id
 
 $save_in_sentbox
 
 $appendInstallationSignature = false
 
 $contextId = null
 
 $contextParameters = []
 
 $logger
 
 $mailOptionsByUsrIdMap = []
 
 $userInstancesByIdMap = []
 
 $usrIdByLoginCallable = null
 
 $maxRecipientCharacterLength = 998
 
 $senderFactory
 

Detailed Description

Class UserMail this class handles user mails.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 15 of file class.ilFormatMail.php.

Constructor & Destructor Documentation

◆ __construct()

ilFormatMail::__construct (   $a_user_id)

Constructor setup an mail object.

Parameters
intuser_id public

Definition at line 24 of file class.ilFormatMail.php.

References ILIAS\GlobalScreen\Provider\__construct().

25  {
26  parent::__construct($a_user_id);
27  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ appendSearchResult()

ilFormatMail::appendSearchResult (   $a_names,
  $a_type 
)

append search result to recipient public

Parameters
arraynames to append
stringrcp type ('to','cc','bc')
Returns
string

Definition at line 129 of file class.ilFormatMail.php.

References $a_type, and ilMail\$mail_data.

130  {
131  if (empty($this->mail_data)) {
132  return false;
133  }
134  $name_str = implode(',', $a_names);
135  switch ($a_type) {
136  case 'to':
137  $this->mail_data["rcp_to"] = trim($this->mail_data["rcp_to"]);
138  if ($this->mail_data["rcp_to"]) {
139  $this->mail_data["rcp_to"] = $this->mail_data["rcp_to"] . ",";
140  }
141  $this->mail_data["rcp_to"] = $this->mail_data["rcp_to"] . $name_str;
142  break;
143 
144  case 'cc':
145  $this->mail_data["rcp_cc"] = trim($this->mail_data["rcp_cc"]);
146  if ($this->mail_data["rcp_cc"]) {
147  $this->mail_data["rcp_cc"] = $this->mail_data["rcp_cc"] . ",";
148  }
149  $this->mail_data["rcp_cc"] = $this->mail_data["rcp_cc"] . $name_str;
150  break;
151 
152  case 'bc':
153  $this->mail_data["rcp_bcc"] = trim($this->mail_data["rcp_bcc"]);
154  if ($this->mail_data["rcp_bcc"]) {
155  $this->mail_data["rcp_bcc"] = $this->mail_data["rcp_bcc"] . ",";
156  }
157  $this->mail_data["rcp_bcc"] = $this->mail_data["rcp_bcc"] . $name_str;
158  break;
159 
160  }
161  return $this->mail_data;
162  }
$a_type
Definition: workflow.php:92

◆ appendSignature()

ilFormatMail::appendSignature ( )

append signature to mail body public

Returns
string

Definition at line 194 of file class.ilFormatMail.php.

195  {
196  return $this->mail_data["m_message"] .= chr(13) . chr(10) . $this->mail_options->getSignature();
197  }

◆ formatForwardSubject()

ilFormatMail::formatForwardSubject ( )

format a forward subject public

Returns
string

Definition at line 114 of file class.ilFormatMail.php.

115  {
116  if (empty($this->mail_data)) {
117  return false;
118  }
119  return $this->mail_data["m_subject"] = "[FWD: " . $this->mail_data["m_subject"] . "]";
120  }

◆ formatLinebreakMessage()

ilFormatMail::formatLinebreakMessage ( string  $message)
Parameters
string$message
Returns
string

Definition at line 168 of file class.ilFormatMail.php.

References $i.

168  : string
169  {
170  $formatted = [];
171 
172  $linebreak = $this->mail_options->getLinebreak();
173 
174  $lines = explode(chr(10), $message);
175  for ($i = 0; $i < count($lines); $i++) {
176  if (substr($lines[$i], 0, 1) != '>') {
177  $formatted[] = wordwrap($lines[$i], $linebreak, chr(10));
178  } else {
179  $formatted[] = $lines[$i];
180  }
181  }
182  $formatted = implode(chr(10), $formatted);
183 
184  return $formatted;
185  }
$message
Definition: xapiexit.php:14
$i
Definition: metadata.php:24

◆ formatReplyMessage()

ilFormatMail::formatReplyMessage ( )

format a reply message public

Returns
string

Definition at line 34 of file class.ilFormatMail.php.

References $i.

35  {
36  if (empty($this->mail_data)) {
37  return false;
38  }
39 
40  $bodylines = preg_split("/\r\n|\n|\r/", $this->mail_data["m_message"]);
41  for ($i = 0; $i < count($bodylines); $i++) {
42  $bodylines[$i] = "> " . $bodylines[$i];
43  }
44 
45  return $this->mail_data["m_message"] = implode(chr(10), $bodylines);
46  }
$i
Definition: metadata.php:24

◆ formatReplyRecipient()

ilFormatMail::formatReplyRecipient ( )

get reply recipient public

Returns
string

Definition at line 98 of file class.ilFormatMail.php.

99  {
100  if (empty($this->mail_data)) {
101  return false;
102  }
103 
104  require_once './Services/User/classes/class.ilObjUser.php';
105 
106  $user = new ilObjUser($this->mail_data["sender_id"]);
107  return $this->mail_data["rcp_to"] = $user->getLogin();
108  }

◆ formatReplyRecipientsForCC()

ilFormatMail::formatReplyRecipientsForCC ( )

get reply recipients for cc public

Returns
string

Definition at line 66 of file class.ilFormatMail.php.

References $DIC.

67  {
68  global $DIC;
69 
70  if (empty($this->mail_data)) {
71  return '';
72  }
73 
74  $newCC = array();
75 
76  $currentUserLogin = $DIC->user()->getLogin();
77 
78  foreach (explode(',', $this->mail_data['rcp_to']) as $to) {
79  if (trim($to) != '' && $currentUserLogin != trim($to)) {
80  $newCC[] = trim($to);
81  }
82  }
83 
84  foreach (explode(',', $this->mail_data['rcp_cc']) as $cc) {
85  if (trim($cc) != '' && $currentUserLogin != trim($cc)) {
86  $newCC[] = trim($cc);
87  }
88  }
89 
90  return ($this->mail_data['rcp_cc'] = implode(', ', $newCC));
91  }
$DIC
Definition: xapitoken.php:46

◆ formatReplySubject()

ilFormatMail::formatReplySubject ( )

format a reply subject public

Returns
string

Definition at line 53 of file class.ilFormatMail.php.

54  {
55  if (empty($this->mail_data)) {
56  return false;
57  }
58  return $this->mail_data["m_subject"] = "RE: " . $this->mail_data["m_subject"];
59  }

◆ prependSignature()

ilFormatMail::prependSignature ( )
Returns
string

Definition at line 202 of file class.ilFormatMail.php.

203  {
204  return $this->mail_options->getSignature() . chr(13) . chr(10) . chr(13) . chr(10) . $this->mail_data["m_message"];
205  }

The documentation for this class was generated from the following file: