ILIAS  release_4-4 Revision
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 ($a_message)
 format message according to linebreak option More...
 
 appendSignature ()
 append signature to mail body public More...
 
 prependSignature ()
 
- Public Member Functions inherited from ilMail
 __construct ($a_user_id)
 Constructor setup an mail object public. More...
 
 __get ($name)
 Magic interceptor method __get Used to include files / instantiate objects at runtime. More...
 
 doesRecipientStillExists ($a_recipient, $a_existing_recipients)
 
 enableSOAP ($a_status)
 
 isSOAPEnabled ()
 
 setSaveInSentbox ($a_save_in_sentbox)
 
 getSaveInSentbox ()
 
 setMailSendType ($a_types)
 
 setMailRcpTo ($a_rcp_to)
 
 setMailRcpCc ($a_rcp_cc)
 
 setMailRcpBc ($a_rcp_bc)
 
 setMailSubject ($a_subject)
 
 setMailMessage ($a_message)
 
 readMailObjectReferenceId ()
 read and set mail object id private More...
 
 getMailObjectReferenceId ()
 
 formatNamesForOutput ($users='')
 Prepends the fullname of each ILIAS login name (is user has a public profile) found in the passed string and brackets the ILIAS login name afterwards. More...
 
 getPreviousMail ($a_mail_id)
 
 getNextMail ($a_mail_id)
 
 getMailsOfFolder ($a_folder_id, $filter=array())
 get all mails of a specific folder public More...
 
 countMailsOfFolder ($a_folder_id)
 count all mails of a specific folder public More...
 
 deleteMailsOfFolder ($a_folder_id)
 delete all mails of a specific folder public More...
 
 getMailCounterData ()
 get mail counter data returns data array with indexes "total","read","unread" public More...
 
 getMail ($a_mail_id)
 get data of one mail public More...
 
 markRead ($a_mail_ids)
 mark mails as read public More...
 
 markUnread ($a_mail_ids)
 mark mails as unread public More...
 
 moveMailsToFolder ($a_mail_ids, $a_folder_id)
 move mail to folder public More...
 
 deleteMails ($a_mail_ids)
 delete mail public More...
 
 fetchMailData ($a_row)
 fetch all query data from table mail public More...
 
 updateDraft ($a_folder_id, $a_attachments, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_type, $a_m_email, $a_m_subject, $a_m_message, $a_draft_id=0, $a_use_placeholders=0)
 
 sendInternalMail ($a_folder_id, $a_sender_id, $a_attachments, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_status, $a_m_type, $a_m_email, $a_m_subject, $a_m_message, $a_user_id=0, $a_use_placeholders=0)
 save mail in folder private More...
 
 replacePlaceholders ($a_message, $a_user_id)
 
 distributeMail ($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_subject, $a_message, $a_attachments, $sent_mail_id, $a_type, $a_action, $a_use_placeholders=0)
 send internal message to recipients private More...
 
 getUserIds ($a_recipients)
 get user_ids More...
 
 checkMail ($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject, $a_m_message, $a_type)
 check if mail is complete, recipients are valid public More...
 
 getEmailsOfRecipients ($a_rcp)
 get email addresses of recipients public More...
 
 checkRecipients ($a_recipients, $a_type)
 check if recipients are valid public More...
 
 savePostData ($a_user_id, $a_attachments, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_type, $a_m_email, $a_m_subject, $a_m_message, $a_use_placeholders)
 save post data in table public More...
 
 getSavedData ()
 get saved data public More...
 
 sendMail ($a_rcp_to, $a_rcp_cc, $a_rcp_bc, $a_m_subject, $a_m_message, $a_attachment, $a_type, $a_use_placeholders=0)
 send external mail using class.ilMimeMail.php More...
 
 parseRcptOfMailingLists ($rcpt='', $maintain_lists=false)
 
 saveInSentbox ($a_attachment, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_type, $a_m_subject, $a_m_message)
 send mime mail using class.ilMimeMail.php More...
 
 sendMimeMail ($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject, $a_m_message, $a_attachments, $a_no_soap=false)
 send mime mail using class.ilMimeMail.php All external mails are send to SOAP::sendMail starting a kind of background process More...
 
 getEmailOfSender ()
 get email of sender public More...
 
 saveAttachments ($a_attachments)
 set attachments More...
 
 getAttachments ()
 get attachments public More...
 
 explodeRecipients ($a_recipients, $use_pear=true)
 explode recipient string allowed seperators are ',' ';' ' ' More...
 
 __getCountRecipient ($rcp, $a_only_email=true)
 
 __getCountRecipients ($a_to, $a_cc, $a_bcc, $a_only_email=true)
 
 __getEmailRecipients ($a_rcp)
 
 __prependMessage ($a_m_message, $rcp_to, $rcp_cc)
 
 __checkSystemRecipients (&$a_rcp_to)
 
 __substituteRecipients ($a_rcp, $direction)
 Note: This function can only be used, when ILIAS is configured to not use standards compliant mail addresses. More...
 
 appendInstallationSignature ($a_flag=null)
 Setter/Getter for appending the installation signarue. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilMail
static addFullname ($a_email, $a_fullname)
 
static getIliasMailerAddress ()
 Builds an email address used for system notifications. More...
 
static _getUserInternalMailboxAddress ($usr_id, $login=null, $firstname=null, $lastname=null)
 STATIC METHOD. More...
 
static _getAutoGeneratedMessageString ($lang=null)
 get auto generated info string More...
 
static _getInstallationSignature ()
 Static getter for the installation signature. More...
 
static getSubjectPrefix ()
 Get text that will be prepended to auto generated mails. More...
 
static getSalutation ($a_usr_id, $a_language=null)
 Get salutation. More...
 
- Data Fields inherited from ilMail
 $ilias
 
 $lng
 
 $mfile
 
 $mail_options
 
 $user_id
 
 $table_mail
 
 $table_mail_saved
 
 $mail_counter
 
 $mail_data
 
 $mail_obj_ref_id
 
 $mail_send_type
 
 $save_in_sentbox
 
 $mail_rcp_to
 
 $mail_rcp_cc
 
 $mail_rcp_bc
 
 $mail_subject
 
 $mail_message
 
 $mail_use_placeholders = 0
 
 $soap_enabled = true
 
 $mail_to_global_roles = 0
 
- Static Protected Member Functions inherited from ilMail
static getCachedUserInstance ($a_usr_id)
 Returns a cached instance of ilObjUser. More...
 
- Protected Attributes inherited from ilMail
 $appendInstallationSignature = false
 
 $properties = array()
 
- Static Protected Attributes inherited from ilMail
static $userInstances = array()
 

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.

25  {
26  parent::__construct($a_user_id);
27  }

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 137 of file class.ilFormatMail.php.

References ilMail\$mail_data.

138  {
139  if(empty($this->mail_data))
140  {
141  return false;
142  }
143  $name_str = implode(',',$a_names);
144  switch($a_type)
145  {
146  case 'to':
147  $this->mail_data["rcp_to"] = trim($this->mail_data["rcp_to"]);
148  if($this->mail_data["rcp_to"])
149  {
150  $this->mail_data["rcp_to"] = $this->mail_data["rcp_to"].",";
151  }
152  $this->mail_data["rcp_to"] = $this->mail_data["rcp_to"] . $name_str;
153  break;
154 
155  case 'cc':
156  $this->mail_data["rcp_cc"] = trim($this->mail_data["rcp_cc"]);
157  if($this->mail_data["rcp_cc"])
158  {
159  $this->mail_data["rcp_cc"] = $this->mail_data["rcp_cc"].",";
160  }
161  $this->mail_data["rcp_cc"] = $this->mail_data["rcp_cc"] . $name_str;
162  break;
163 
164  case 'bc':
165  $this->mail_data["rcp_bcc"] = trim($this->mail_data["rcp_bcc"]);
166  if($this->mail_data["rcp_bcc"])
167  {
168  $this->mail_data["rcp_bcc"] = $this->mail_data["rcp_bcc"].",";
169  }
170  $this->mail_data["rcp_bcc"] = $this->mail_data["rcp_bcc"] . $name_str;
171  break;
172 
173  }
174  return $this->mail_data;
175  }

◆ appendSignature()

ilFormatMail::appendSignature ( )

append signature to mail body public

Returns
string

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

214  {
215  return $this->mail_data["m_message"] .= chr(13).chr(10).$this->mail_options->getSignature();
216  }

◆ formatForwardSubject()

ilFormatMail::formatForwardSubject ( )

format a forward subject public

Returns
string

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

122  {
123  if(empty($this->mail_data))
124  {
125  return false;
126  }
127  return $this->mail_data["m_subject"] = "[FWD: ".$this->mail_data["m_subject"]."]";
128  }

◆ formatLinebreakMessage()

ilFormatMail::formatLinebreakMessage (   $a_message)

format message according to linebreak option

Parameters
stringmessage public
Returns
string formatted message

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

183  {
184  $formatted = array();
185 
186 # debug($a_message);
187  $linebreak = $this->mail_options->getLinebreak();
188  // SPLIT INTO LINES returns always an array
189  $lines = explode(chr(10),$a_message);
190  for($i=0;$i<count($lines);$i++)
191  {
192  if(substr($lines[$i],0,1) != '>')
193  {
194  $formatted[] = wordwrap($lines[$i],$linebreak,chr(10));
195  }
196  else
197  {
198  $formatted[] = $lines[$i];
199  }
200  }
201  $formatted = implode(chr(10),$formatted);
202 # debug($formatted);
203  return $formatted;
204  }

◆ formatReplyMessage()

ilFormatMail::formatReplyMessage ( )

format a reply message public

Returns
string

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

35  {
36  if(empty($this->mail_data))
37  {
38  return false;
39  }
40 # debug($this->mail_data["m_message"]);
41  $bodylines = explode(chr(13).chr(10), $this->mail_data["m_message"]);
42 # var_dump("<pre>",$bodylines,"</pre");
43  for ($i = 0; $i < count($bodylines); $i++)
44  {
45  $bodylines[$i] = "> ".$bodylines[$i];
46  }
47  return $this->mail_data["m_message"] = implode(chr(13).chr(10), $bodylines);
48  }

◆ formatReplyRecipient()

ilFormatMail::formatReplyRecipient ( )

get reply recipient public

Returns
string

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

105  {
106  if(empty($this->mail_data))
107  {
108  return false;
109  }
110 
111  require_once './Services/User/classes/class.ilObjUser.php';
112 
113  $user = new ilObjUser($this->mail_data["sender_id"]);
114  return $this->mail_data["rcp_to"] = $user->getLogin();
115  }

◆ formatReplyRecipientsForCC()

ilFormatMail::formatReplyRecipientsForCC ( )

get reply recipients for cc public

Returns
string

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

References $ilUser.

70  {
71  global $ilUser;
72 
73  if(empty($this->mail_data))
74  {
75  return '';
76  }
77 
78  $newCC = array();
79 
80  foreach (explode(',', $this->mail_data['rcp_to']) as $to)
81  {
82  if (trim($to) != '' && $ilUser->getLogin() != trim($to))
83  {
84  $newCC[] = trim($to);
85  }
86  }
87 
88  foreach (explode(',', $this->mail_data['rcp_cc']) as $cc)
89  {
90  if (trim($cc) != '' && $ilUser->getLogin() != trim($cc))
91  {
92  $newCC[] = trim($cc);
93  }
94  }
95 
96  return ($this->mail_data['rcp_cc'] = implode(', ', $newCC));
97  }
global $ilUser
Definition: imgupload.php:15

◆ formatReplySubject()

ilFormatMail::formatReplySubject ( )

format a reply subject public

Returns
string

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

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

◆ prependSignature()

ilFormatMail::prependSignature ( )
Returns
string

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

222  {
223  return $this->mail_options->getSignature().chr(13).chr(10).chr(13).chr(10).$this->mail_data["m_message"];
224  }

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