ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilFormatMail Class Reference
+ Inheritance diagram for ilFormatMail:
+ Collaboration diagram for ilFormatMail:

Public Member Functions

 __construct (int $a_user_id)
 
 formatReplyRecipientsForCC ()
 
 formatReplyRecipient ()
 
 appendSearchResult (array $a_names, string $a_type)
 
 formatLinebreakMessage (string $message)
 
 appendSignature (string $message)
 
 prependSignature (string $message)
 
 formatReplyMessage (string $message)
 
 formatReplySubject (string $subject)
 
 formatForwardSubject (string $subject)
 
- Public Member Functions inherited from ilMail
 __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)
 
 withContextId (string $contextId)
 
 withContextParameters (array $parameters)
 
 existsRecipient (string $newRecipient, string $existingRecipients)
 
 setSaveInSentbox (bool $saveInSentbox)
 
 getSaveInSentbox ()
 
 getMailObjectReferenceId ()
 
 formatNamesForOutput (string $recipients)
 
 getPreviousMail (int $mailId)
 
 getNextMail (int $mailId)
 
 getMailsOfFolder (int $a_folder_id, array $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 $folderId)
 
 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=[])
 
 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=[])
 
 retrieveFromStage ()
 
 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'. 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 ilMail::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)
 
static _getInstallationSignature ()
 
static getSalutation (int $a_usr_id, ?ilLanguage $a_language=null)
 
- Data Fields inherited from ilMail
const ILIAS_HOST = 'ilias'
 
const PROP_CONTEXT_SUBJECT_PREFIX = 'subject_prefix'
 
int $user_id
 
- Protected Member Functions inherited from ilMail
 isSystemMail ()
 
 readMailObjectReferenceId ()
 
 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)
 
 saveInSentbox (array $attachment, string $to, string $cc, string $bcc, string $subject, string $message)
 
 parseAddresses (string $addresses)
 Explode recipient string, allowed separators are ',' ';' ' '. More...
 
 getCountRecipient (string $recipients, bool $onlyExternalAddresses=true)
 
 getCountRecipients (string $toRecipients, string $ccRecipients, string $bccRecipients, bool $onlyExternalAddresses=true)
 
 getEmailRecipients (string $recipients)
 
 getUserInstanceById (int $usrId)
 
 getMailOptionsByUserId (int $usrId)
 
- Protected Attributes inherited from ilMail
ilLanguage $lng
 
ilDBInterface $db
 
ilFileDataMail $mfile
 
ilMailOptions $mail_options
 
ilMailbox $mailbox
 
string $table_mail
 
string $table_mail_saved
 
array $mail_data = []
 
int $mail_obj_ref_id = null
 
bool $save_in_sentbox
 
bool $appendInstallationSignature = false
 
string $contextId = null
 
array $contextParameters = []
 
ilLogger $logger
 
array $mailOptionsByUsrIdMap = []
 
array $userInstancesByIdMap = []
 
 $usrIdByLoginCallable
 
int $maxRecipientCharacterLength = 998
 
ilMailMimeSenderFactory $senderFactory
 
ilObjUser $actor
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om TODO All these utility functions could be moved to some kind of decorator once a mail is an elaborated object and not an array anymore

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

Constructor & Destructor Documentation

◆ __construct()

ilFormatMail::__construct ( int  $a_user_id)

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

References ILIAS\GlobalScreen\Provider\__construct().

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

Member Function Documentation

◆ appendSearchResult()

ilFormatMail::appendSearchResult ( array  $a_names,
string  $a_type 
)
Parameters
string[]$a_names
string$a_type
Returns
array

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

References ILIAS\LTI\ToolProvider\$key, and ilMail\$mail_data.

76  : array
77  {
78  $name_str = implode(',', $a_names);
79 
80  $key = 'rcp_to';
81  if ('cc' === $a_type) {
82  $key = 'rcp_cc';
83  } elseif ('bc' === $a_type) {
84  $key = 'rcp_bcc';
85  }
86 
87  if (!isset($this->mail_data[$key]) || !is_string($this->mail_data[$key])) {
88  $this->mail_data[$key] = '';
89  } else {
90  $this->mail_data[$key] = trim($this->mail_data[$key]);
91  }
92 
93  if ($this->mail_data[$key] !== '') {
94  $this->mail_data[$key] .= ',';
95  }
96  $this->mail_data[$key] .= $name_str;
97 
98  return $this->mail_data;
99  }
array $mail_data
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ appendSignature()

ilFormatMail::appendSignature ( string  $message)

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

References $message.

118  : string
119  {
120  $message .= chr(13) . chr(10) . $this->mail_options->getSignature();
121 
122  return $message;
123  }
$message
Definition: xapiexit.php:32

◆ formatForwardSubject()

ilFormatMail::formatForwardSubject ( string  $subject)

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

150  : string
151  {
152  return '[FWD: ' . $subject . ']';
153  }

◆ formatLinebreakMessage()

ilFormatMail::formatLinebreakMessage ( string  $message)

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

101  : string
102  {
103  $formatted = [];
104 
105  $linebreak = $this->mail_options->getLinebreak();
106 
107  $lines = explode(chr(10), $message);
108  foreach ($lines as $iValue) {
109  if (strpos($iValue, '>') !== 0) {
110  $formatted[] = wordwrap($iValue, $linebreak, chr(10));
111  } else {
112  $formatted[] = $iValue;
113  }
114  }
115  return implode(chr(10), $formatted);
116  }
$message
Definition: xapiexit.php:32

◆ formatReplyMessage()

ilFormatMail::formatReplyMessage ( string  $message)

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

References $i.

135  : string
136  {
137  $bodylines = preg_split("/\r\n|\n|\r/", $message);
138  foreach ($bodylines as $i => $iValue) {
139  $bodylines[$i] = '> ' . $iValue;
140  }
141 
142  return implode(chr(10), $bodylines);
143  }
$message
Definition: xapiexit.php:32
$i
Definition: metadata.php:41

◆ formatReplyRecipient()

ilFormatMail::formatReplyRecipient ( )

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

61  : string
62  {
63  if (empty($this->mail_data)) {
64  return '';
65  }
66 
67  $user = new ilObjUser((int) $this->mail_data['sender_id']);
68  return $this->mail_data['rcp_to'] = $user->getLogin();
69  }

◆ formatReplyRecipientsForCC()

ilFormatMail::formatReplyRecipientsForCC ( )

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

References $DIC.

32  : string
33  {
34  global $DIC;
35 
36  if (empty($this->mail_data)) {
37  return '';
38  }
39 
40  $newCC = [];
41 
42  $currentUserLogin = $DIC->user()->getLogin();
43 
44  foreach (explode(',', $this->mail_data['rcp_to']) as $to) {
45  $to = trim($to);
46  if ($to !== '' && $currentUserLogin !== $to) {
47  $newCC[] = $to;
48  }
49  }
50 
51  foreach (explode(',', $this->mail_data['rcp_cc']) as $cc) {
52  $cc = trim($cc);
53  if ($cc !== '' && $currentUserLogin !== $cc) {
54  $newCC[] = $cc;
55  }
56  }
57 
58  return $this->mail_data['rcp_cc'] = implode(', ', $newCC);
59  }
global $DIC
Definition: feed.php:28

◆ formatReplySubject()

ilFormatMail::formatReplySubject ( string  $subject)

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

145  : string
146  {
147  return 'RE: ' . $subject;
148  }

◆ prependSignature()

ilFormatMail::prependSignature ( string  $message)

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

References $message.

125  : string
126  {
127  return $this->mail_options->getSignature() .
128  chr(13) .
129  chr(10) .
130  chr(13) .
131  chr(10) .
132  $message;
133  }
$message
Definition: xapiexit.php:32

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