ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilFormatMail Class Reference
+ Inheritance diagram for ilFormatMail:
+ Collaboration diagram for ilFormatMail:

Public Member Functions

 formatReplyRecipientsForCC ()
 
 formatReplyRecipient ()
 
 appendSearchResult (array $a_names, string $a_type)
 
 appendSignature (string $message)
 
 prependSignature (string $message)
 
 formatReplyMessage (string $message)
 
 formatReplySubject (string $subject)
 
 formatForwardSubject (string $subject)
 
- Public Member Functions inherited from ilMail
 __construct (private int $a_user_id, private ?ilMailAddressTypeFactory $mail_address_type_factory=null, private ilMailRfc822AddressParserFactory $mail_address_parser_factory=new ilMailRfc822AddressParserFactory(), private ?ilAppEventHandler $event_handler=null, private ?ilLogger $logger=null, private ?ilDBInterface $db=null, private ?ilLanguage $lng=null, private ?ilFileDataMail $mail_file_data=null, protected ?ilMailOptions $mail_options=null, private ?ilMailbox $mailbox=null, private ?ilMailMimeSenderFactory $sender_factory=null, private ?Closure $usr_id_by_login_callable=null, private ?AutoresponderService $auto_responder_service=null, private ?int $mail_admin_node_ref_id=null, private ?int $mail_obj_ref_id=null, private ?ilObjUser $actor=null, private ?ilMailTemplatePlaceholderResolver $placeholder_resolver=null, private ?ilMailTemplatePlaceholderToEmptyResolver $placeholder_to_empty_resolver=null, ?Conductor $legal_documents=null, ?MailSignatureService $signature_service=null,)
 
 autoresponder ()
 
 withContextId (string $context_id)
 
 withContextParameters (array $parameters)
 
 existsRecipient (string $new_recipient, string $existing_recipients)
 
 setSaveInSentbox (bool $save_in_sentbox)
 
 getSaveInSentbox ()
 
 getMailObjectReferenceId ()
 
 formatNamesForOutput (string $recipients)
 
 getPreviousMail (int $mail_id)
 
 getNextMail (int $mail_id)
 
 getMailsOfFolder (int $a_folder_id, array $filter=[])
 
 countMailsOfFolder (int $folder_id)
 
 deleteMailsOfFolder (int $folder_id)
 
 getMail (int $mail_id)
 
 markRead (array $mail_ids)
 
 markUnread (array $mail_ids)
 
 moveMailsToFolder (array $mail_ids, int $folder_id)
 
 deleteMails (array $mail_ids)
 
 getNewDraftId (int $folder_id)
 
 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 (MailDeliveryData $mail_data)
 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 $user_instances_by_id_map)
 
 setMailOptionsByUserIdMap (array $mail_options_by_usr_id_map)
 
 formatLinebreakMessage (string $message)
 

Additional Inherited Members

- Static Public Member Functions inherited from ilMail
static _getAutoGeneratedMessageString (?ilLanguage $lang=null)
 
static _getIliasMailerName ()
 
static _getInstallationSignature ()
 
static getSalutation (int $a_usr_id, ?ilLanguage $a_language=null)
 
- Data Fields inherited from ilMail
const string ILIAS_HOST = 'ilias'
 
const string PROP_CONTEXT_SUBJECT_PREFIX = 'subject_prefix'
 
int $user_id
 
- Protected Attributes inherited from ilMail
array $mail_data = []
 

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.

Member Function Documentation

◆ appendSearchResult()

ilFormatMail::appendSearchResult ( array  $a_names,
string  $a_type 
)
Parameters
list<string>$a_names

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

References ilMail\$mail_data.

69  : array
70  {
71  $name_str = implode(',', $a_names);
72 
73  $key = 'rcp_to';
74  if ($a_type === 'cc') {
75  $key = 'rcp_cc';
76  } elseif ($a_type === 'bc') {
77  $key = 'rcp_bcc';
78  }
79 
80  if (!isset($this->mail_data[$key]) || !is_string($this->mail_data[$key])) {
81  $this->mail_data[$key] = '';
82  } else {
83  $this->mail_data[$key] = trim($this->mail_data[$key]);
84  }
85 
86  if ($this->mail_data[$key] !== '') {
87  $this->mail_data[$key] .= ',';
88  }
89  $this->mail_data[$key] .= $name_str;
90 
91  return $this->mail_data;
92  }
array $mail_data

◆ appendSignature()

ilFormatMail::appendSignature ( string  $message)

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

94  : string
95  {
96  return $message . (chr(13) . chr(10) . $this->mail_options->getSignature());
97  }
$message
Definition: xapiexit.php:31

◆ formatForwardSubject()

ilFormatMail::formatForwardSubject ( string  $subject)

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

124  : string
125  {
126  return '[FWD: ' . $subject . ']';
127  }

◆ formatReplyMessage()

ilFormatMail::formatReplyMessage ( string  $message)

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

109  : string
110  {
111  $bodylines = preg_split("/\r\n|\n|\r/", $message);
112  foreach ($bodylines as $i => $value) {
113  $bodylines[$i] = '> ' . $value;
114  }
115 
116  return implode(chr(10), $bodylines);
117  }
$message
Definition: xapiexit.php:31

◆ formatReplyRecipient()

ilFormatMail::formatReplyRecipient ( )

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

56  : string
57  {
58  if (empty($this->mail_data)) {
59  return '';
60  }
61 
62  $user = new ilObjUser((int) $this->mail_data['sender_id']);
63  return $this->mail_data['rcp_to'] = $user->getLogin();
64  }

◆ formatReplyRecipientsForCC()

ilFormatMail::formatReplyRecipientsForCC ( )

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

References $DIC.

27  : string
28  {
29  global $DIC;
30 
31  if (empty($this->mail_data)) {
32  return '';
33  }
34 
35  $new_cc = [];
36 
37  $current_usr_login = $DIC->user()->getLogin();
38 
39  foreach (explode(',', (string) $this->mail_data['rcp_to']) as $to) {
40  $to = trim($to);
41  if ($to !== '' && $current_usr_login !== $to) {
42  $new_cc[] = $to;
43  }
44  }
45 
46  foreach (explode(',', (string) $this->mail_data['rcp_cc']) as $cc) {
47  $cc = trim($cc);
48  if ($cc !== '' && $current_usr_login !== $cc) {
49  $new_cc[] = $cc;
50  }
51  }
52 
53  return $this->mail_data['rcp_cc'] = implode(', ', $new_cc);
54  }
global $DIC
Definition: shib_login.php:26

◆ formatReplySubject()

ilFormatMail::formatReplySubject ( string  $subject)

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

119  : string
120  {
121  return 'RE: ' . $subject;
122  }

◆ prependSignature()

ilFormatMail::prependSignature ( string  $message)

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

References $message.

99  : string
100  {
101  return $this->mail_options->getSignature() .
102  chr(13) .
103  chr(10) .
104  chr(13) .
105  chr(10) .
106  $message;
107  }
$message
Definition: xapiexit.php:31

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