ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMail Class Reference

This class handles base functions for mail handling. More...

+ Inheritance diagram for ilMail:
+ Collaboration diagram for ilMail:

Public Member Functions

 existsRecipient ($a_recipient, $a_existing_recipients)
 
 enableSOAP ($a_status)
 Define if external mails should be sent using SOAP client or not. More...
 
 setSaveInSentbox ($a_save_in_sentbox)
 
 getSaveInSentbox ()
 
 getMailObjectReferenceId ()
 
 getPreviousMail ($a_mail_id)
 
 getNextMail ($a_mail_id)
 
 getMailsOfFolder ($a_folder_id, $filter=array())
 
 countMailsOfFolder ($a_folder_id)
 
 deleteMailsOfFolder ($a_folder_id)
 
 getMail ($a_mail_id)
 
 markRead (array $a_mail_ids)
 
 markUnread (array $a_mail_ids)
 
 moveMailsToFolder (array $a_mail_ids, $a_folder_id)
 
 deleteMails (array $a_mail_ids)
 
 getNewDraftId ($usrId, $folderId)
 
 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, $a_tpl_context_id=null, $a_tpl_context_params=array())
 
 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, $a_tpl_context_id=null, $a_tpl_context_params=array())
 save mail in folder @access private 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, $a_tpl_context_id=null, $a_tpl_ctx_params=array())
 save post data in table @access public More...
 
 getSavedData ()
 
 validateRecipients ($a_rcp_to, $a_rcp_cc, $a_rcp_bc)
 
 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. More...
 
 saveAttachments ($a_attachments)
 
 appendInstallationSignature ($a_flag=null)
 Setter/Getter for appending the installation signarue. More...
 

Data Fields

const ILIAS_HOST = 'ilias'
 
 $user_id
 

Protected Member Functions

 readMailObjectReferenceId ()
 Read and set the mail object ref id (administration node) More...
 
 fetchMailData ($a_row)
 
 replacePlaceholders ($a_message, $a_user_id=0, $replace_empty=true)
 
 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)
 
 getUserIds ($a_recipients)
 
 checkMail ($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject, $a_m_message, $a_type)
 
 checkRecipients ($a_recipients)
 Check if recipients are valid. More...
 
 saveInSentbox ($a_attachment, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_type, $a_m_subject, $a_m_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 ($a_recipients, $a_only_email=true)
 
 getCountRecipients ($a_to, $a_cc, $a_bcc, $a_only_email=true)
 
 getEmailRecipients ($a_recipients)
 

Static Protected Member Functions

static getCachedUserInstance ($a_usr_id)
 

Protected Attributes

 $lng
 
 $db
 
 $mfile
 
 $mail_options
 
 $table_mail
 
 $table_mail_saved
 
 $mail_data = array()
 
 $mail_obj_ref_id
 
 $save_in_sentbox
 
 $soap_enabled = true
 
 $mail_to_global_roles = 0
 
 $appendInstallationSignature = false
 
 $properties = array()
 

Static Protected Attributes

static $userInstances = array()
 

Detailed Description

This class handles base functions for mail handling.

RFC 822 compliant email addresses

ILIAS is enabled to use standards compliant email addresses. The class supports RFC 822 compliant address lists as specified in http://www.ietf.org/rfc/rfc0822.txt

Examples: The following mailbox addresses work for sending an email to the user with the login john.doe and email address jd@ma.nosp@m.il.c.nosp@m.om. The user is member of the course "French Course". The member role of the course object has the name "il_crs_member_998" and the object ID "1000".

john.doe John Doe <john.doe> john.doe@ilias #member@[French Course] #il_crs_member_998 #il_role_1000 jd@ma.nosp@m.il.c.nosp@m.om John Doe jd@ma.nosp@m.il.c.nosp@m.om

Syntax Rules: The following excerpt from chapter 6.1 "Syntax" of RFC 822 is relevant for the semantics described below:

addr-spec = local-part [ "@", domain ]

Semantics: User account mailbox address:

  • The local-part denotes the login of an ILIAS user account.
  • The domain denotes the current ILIAS client.
  • The local-part must not start with a "#" character
  • The domain must be omitted or must have the value "ilias"

Role object mailbox address:

  • The local part denotes the title of an ILIAS role.
  • The domain denotes the title of an ILIAS object.
  • The local-part must start with a "#" character.
  • If the domain is omitted, the title "ilias" is assumed.
  • If the local-part starts with "#il_role_" its remaining characters directly specify the object id of the role. For example "#il_role_1234 identifies the role with object id "1234". - If the object title identifies an object that is an ILIAS role, then the local-part is ignored. - If the object title identifies an object that is not an ILIAS role, then the local-part is used to identify a local role for that object. - The local-part can be a substring of the role name. For example, "#member" can be used instead of "#il_crs_member_1234". External Email address: - The local-part must not start with a "#" character - The domain must be specified and it must not have the value "ilias"
Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Member Function Documentation

◆ appendInstallationSignature()

ilMail::appendInstallationSignature (   $a_flag = null)

Setter/Getter for appending the installation signarue.

Parameters
mixedboolean or nothing
Returns
mixed boolean if called without passing any params, otherwise $this

Definition at line 1629 of file class.ilMail.php.

1630 {
1631 if(null === $a_flag)
1632 {
1634 }
1635
1636 $this->appendInstallationSignature = $a_flag;
1637 return $this;
1638 }
appendInstallationSignature($a_flag=null)
Setter/Getter for appending the installation signarue.
$appendInstallationSignature

References $appendInstallationSignature, and appendInstallationSignature().

Referenced by appendInstallationSignature().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkMail()

ilMail::checkMail (   $a_rcp_to,
  $a_rcp_cc,
  $a_rcp_bcc,
  $a_m_subject,
  $a_m_message,
  $a_type 
)
protected
Parameters
string$a_rcp_to
string$a_rcp_cc
string$a_rcp_bcc
string$a_m_subject
string$a_m_message
string$a_type
Returns
string array message

Definition at line 989 of file class.ilMail.php.

990 {
991 $errors = array();
992 foreach(array(
993 $a_m_subject => array('mail_add_subject'),
994 $a_rcp_to => array('mail_add_recipient')
995 ) as $string => $e)
996 {
997 if(strlen($string) === 0)
998 {
999 $errors[] = $e;
1000 }
1001 }
1002
1003 return $errors;
1004 }
$errors

References $errors.

◆ checkRecipients()

ilMail::checkRecipients (   $a_recipients)
protected

Check if recipients are valid.

Parameters
string$a_recipientsstring with login names or group names (start with #)
string$a_type
Returns
array Returns an empty array, if all recipients are okay. Returns an array with invalid recipients, if some are not okay.
Exceptions
ilMailException

Definition at line 1013 of file class.ilMail.php.

1014 {
1015 $errors = array();
1016
1017 try
1018 {
1019 require_once 'Services/Mail/classes/Address/Type/class.ilMailAddressTypeFactory.php';
1020 $recipients = $this->parseAddresses($a_recipients);
1021 foreach($recipients as $recipient)
1022 {
1023 $address_type = ilMailAddressTypeFactory::getByPrefix($recipient);
1024 if(!$address_type->validate($this->user_id))
1025 {
1026 $errors = array_merge($errors, $address_type->getErrors());
1027 }
1028 }
1029 }
1030 catch(ilException $e)
1031 {
1032 $colon_pos = strpos($e->getMessage(), ':');
1033 throw new ilMailException(($colon_pos === false) ? $e->getMessage() : substr($e->getMessage(), $colon_pos + 2));
1034 }
1035
1036 return $errors;
1037 }
Base class for ILIAS Exception handling.
static getByPrefix(ilMailAddress $a_address)
Class ilMailException.
parseAddresses($addresses)
Explode recipient string, allowed separators are ',' ';' ' ' Returns an array with recipient ilMailAd...

References $errors, ilMailAddressTypeFactory\getByPrefix(), and parseAddresses().

Referenced by validateRecipients().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ countMailsOfFolder()

ilMail::countMailsOfFolder (   $a_folder_id)
Parameters
int$a_folder_id
Returns
int

Definition at line 400 of file class.ilMail.php.

401 {
402 $res = $this->db->queryF("
403 SELECT COUNT(*) FROM {$this->table_mail}
404 WHERE user_id = %s AND folder_id = %s",
405 array('integer', 'integer'),
406 array($this->user_id, $a_folder_id));
407
408 return $this->db->numRows($res);
409 }

References $res.

◆ deleteMails()

ilMail::deleteMails ( array  $a_mail_ids)
Parameters
array$a_mail_ids
Returns
bool

Definition at line 561 of file class.ilMail.php.

562 {
563 foreach($a_mail_ids as $id)
564 {
565 $this->db->manipulateF("
566 DELETE FROM {$this->table_mail}
567 WHERE user_id = %s AND mail_id = %s ",
568 array('integer', 'integer'),
569 array($this->user_id, $id)
570 );
571 $this->mfile->deassignAttachmentFromDirectory($id);
572 }
573
574 return true;
575 }

Referenced by deleteMailsOfFolder().

+ Here is the caller graph for this function:

◆ deleteMailsOfFolder()

ilMail::deleteMailsOfFolder (   $a_folder_id)
Parameters
int$a_folder_idid of folder
Returns
bool

Definition at line 415 of file class.ilMail.php.

416 {
417 if($a_folder_id)
418 {
419 $mails = $this->getMailsOfFolder($a_folder_id);
420 foreach((array)$mails as $mail_data)
421 {
422 $this->deleteMails(array($mail_data['mail_id']));
423 }
424
425 return true;
426 }
427
428 return false;
429 }
deleteMails(array $a_mail_ids)
getMailsOfFolder($a_folder_id, $filter=array())

References $mail_data, deleteMails(), and getMailsOfFolder().

+ Here is the call graph for this function:

◆ distributeMail()

ilMail::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 
)
protected
Parameters
string$a_rcp_to
string$a_rcp_cc
string$a_rcp_bcc
string$a_subject
string$a_message
array$a_attachments
integer$sent_mail_id
array$a_type
array$a_action
array | int$a_use_placeholders
Returns
bool

Definition at line 764 of file class.ilMail.php.

765 {
766 require_once 'Services/Mail/classes/class.ilMailbox.php';
767 require_once 'Services/User/classes/class.ilObjUser.php';
768
769 $mbox = new ilMailbox();
770 if(!$a_use_placeholders)
771 {
772 $rcp_ids = $this->getUserIds(trim($a_rcp_to) . ',' . trim($a_rcp_cc) . ',' . trim($a_rcp_bcc));
773
774 ilLoggerFactory::getLogger('mail')->debug(sprintf(
775 "Parsed TO/CC/BCC user ids from given recipients: %s", implode(', ', $rcp_ids)
776 ));
777
778 $as_email = array();
779
780 foreach($rcp_ids as $id)
781 {
782 $tmp_mail_options = new ilMailOptions($id);
783
784 $tmp_user = self::getCachedUserInstance($id);
785 $user_is_active = $tmp_user->getActive();
786 $user_can_read_internal_mails = !$tmp_user->hasToAcceptTermsOfService() && $tmp_user->checkTimeLimit();
787
788 if(in_array('system', $a_type) && !$user_can_read_internal_mails)
789 {
790 continue;
791 }
792
793 if($user_is_active)
794 {
795 if(!$user_can_read_internal_mails || $tmp_mail_options->getIncomingType() == $this->mail_options->EMAIL)
796 {
797 $as_email[] = $tmp_user->getEmail();
798 continue;
799 }
800
801 if($tmp_mail_options->getIncomingType() == $this->mail_options->BOTH)
802 {
803 $as_email[] = $tmp_user->getEmail();
804 }
805 }
806
807 $mbox->setUserId($id);
808 $inbox_id = $mbox->getInboxFolder();
809
810 $mail_id = $this->sendInternalMail(
811 $inbox_id, $this->user_id, $a_attachments, $a_rcp_to, $a_rcp_cc, '',
812 'unread', $a_type, 0, $a_subject, $a_message, $id, 0
813 );
814
815 if($a_attachments)
816 {
817 $this->mfile->assignAttachmentsToDirectory($mail_id, $sent_mail_id, $a_attachments);
818 }
819 }
820
821 $to = array();
822 $bcc = array();
823
824 if(count($as_email) == 1)
825 {
826 $to[] = $as_email[0];
827 }
828 else
829 {
830 foreach ($as_email as $email)
831 {
832 $bcc[] = $email;
833 }
834 }
835
836 if(count($to) > 0 || count($bcc) > 0)
837 {
838 $this->sendMimeMail(implode(',', $to), '', implode(',', $bcc), $a_subject, $a_message, $a_attachments);
839 }
840 }
841 else
842 {
843 $rcp_ids_replace = $this->getUserIds(trim($a_rcp_to));
844 $rcp_ids_no_replace = $this->getUserIds(trim($a_rcp_cc).','.trim($a_rcp_bcc));
845
846 ilLoggerFactory::getLogger('mail')->debug(sprintf(
847 "Parsed TO user ids from given recipients for serial letter notification: %s", implode(', ', $rcp_ids_replace)
848 ));
849 ilLoggerFactory::getLogger('mail')->debug(sprintf(
850 "Parsed CC/BCC user ids from given recipients for serial letter notification: %s", implode(', ', $rcp_ids_no_replace)
851 ));
852
853 $as_email = array();
854 $id_to_message_map = array();
855
856 foreach($rcp_ids_replace as $id)
857 {
858 $tmp_mail_options = new ilMailOptions($id);
859
860 $tmp_user = self::getCachedUserInstance($id);
861 $user_is_active = $tmp_user->getActive();
862 $user_can_read_internal_mails = !$tmp_user->hasToAcceptTermsOfService() && $tmp_user->checkTimeLimit();
863
864 if(in_array('system', $a_type) && !$user_can_read_internal_mails)
865 {
866 continue;
867 }
868
869 $id_to_message_map[$id] = $this->replacePlaceholders($a_message, $id);
870
871 if($user_is_active)
872 {
873 if(!$user_can_read_internal_mails || $tmp_mail_options->getIncomingType() == $this->mail_options->EMAIL)
874 {
875 $as_email[$tmp_user->getId()] = $tmp_user->getEmail();
876 continue;
877 }
878
879 if($tmp_mail_options->getIncomingType() == $this->mail_options->BOTH)
880 {
881 $as_email[$tmp_user->getId()] = $tmp_user->getEmail();
882 }
883 }
884
885 $mbox->setUserId($id);
886 $inbox_id = $mbox->getInboxFolder();
887
888 $mail_id = $this->sendInternalMail(
889 $inbox_id, $this->user_id, $a_attachments, $a_rcp_to, $a_rcp_cc, '',
890 'unread', $a_type, 0, $a_subject, $id_to_message_map[$id], $id, 0
891 );
892
893 if($a_attachments)
894 {
895 $this->mfile->assignAttachmentsToDirectory($mail_id, $sent_mail_id, $a_attachments);
896 }
897 }
898
899 if(count($as_email))
900 {
901 foreach($as_email as $id => $email)
902 {
903 $this->sendMimeMail($email, '', '', $a_subject, $id_to_message_map[$id], $a_attachments);
904 }
905 }
906
907 $as_email = array();
908
909 $cc_and_bcc_message = $this->replacePlaceholders($a_message, 0, false);
910
911 foreach($rcp_ids_no_replace as $id)
912 {
913 $tmp_mail_options = new ilMailOptions($id);
914
915 $tmp_user = self::getCachedUserInstance($id);
916 $user_is_active = $tmp_user->getActive();
917 $user_can_read_internal_mails = !$tmp_user->hasToAcceptTermsOfService() && $tmp_user->checkTimeLimit();
918
919 if($user_is_active)
920 {
921 if(in_array('system', $a_type) && !$user_can_read_internal_mails)
922 {
923 continue;
924 }
925
926 if(!$user_can_read_internal_mails || $tmp_mail_options->getIncomingType() == $this->mail_options->EMAIL)
927 {
928 $as_email[] = $tmp_user->getEmail();
929 continue;
930 }
931
932 if($tmp_mail_options->getIncomingType() == $this->mail_options->BOTH)
933 {
934 $as_email[] = $tmp_user->getEmail();
935 }
936 }
937
938 $mbox->setUserId($id);
939 $inbox_id = $mbox->getInboxFolder();
940
941 $mail_id = $this->sendInternalMail(
942 $inbox_id, $this->user_id, $a_attachments, $a_rcp_to, $a_rcp_cc, '',
943 'unread', $a_type, 0, $a_subject, $cc_and_bcc_message, $id, 0
944 );
945
946 if($a_attachments)
947 {
948 $this->mfile->assignAttachmentsToDirectory($mail_id, $sent_mail_id, $a_attachments);
949 }
950 }
951
952 if(count($as_email))
953 {
954 $this->sendMimeMail('', '', implode(',', $as_email), $a_subject, $cc_and_bcc_message, $a_attachments);
955 }
956 }
957
958 return true;
959 }
sprintf('%.4f', $callTime)
static getLogger($a_component_id)
Get component logger.
Class UserMail this class handles user mails.
static getCachedUserInstance($a_usr_id)
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.
replacePlaceholders($a_message, $a_user_id=0, $replace_empty=true)
getUserIds($a_recipients)
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, $a_tpl_context_id=null, $a_tpl_context_params=array())
save mail in folder @access private
Mail Box class Base class for creating and handling mail boxes.
$a_type
Definition: workflow.php:93

References $a_type, getCachedUserInstance(), ilLoggerFactory\getLogger(), getUserIds(), replacePlaceholders(), sendInternalMail(), sendMimeMail(), and sprintf.

+ Here is the call graph for this function:

◆ enableSOAP()

ilMail::enableSOAP (   $a_status)

Define if external mails should be sent using SOAP client or not.

The autogenerated mails in new user registration sets this value to false, since there is no valid session.

Parameters
bool$a_status

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

214 {
215 $this->soap_enabled = (bool)$a_status;
216 }

◆ existsRecipient()

ilMail::existsRecipient (   $a_recipient,
  $a_existing_recipients 
)
Parameters
string$a_recipient
string$a_existing_recipients
Returns
bool

Definition at line 177 of file class.ilMail.php.

178 {
179 $recipients = $this->parseAddresses($a_existing_recipients);
180 foreach($recipients as $rcp)
181 {
182 if(substr($rcp->getMailbox(), 0, 1) != '#')
183 {
184 if(trim($rcp->getMailbox()) == trim($a_recipient) || trim($rcp->getMailbox() . '@' . $rcp->getHost()) == trim($a_recipient))
185 {
186 return true;
187 }
188 }
189 else if(substr($rcp->getMailbox(), 0, 7) == '#il_ml_')
190 {
191 if(trim($rcp->getMailbox() . '@' . $rcp->getHost()) == trim($a_recipient))
192 {
193 return true;
194 }
195 }
196 else
197 {
198 if(trim($rcp->getMailbox() . '@' . $rcp->getHost()) == trim($a_recipient))
199 {
200 return true;
201 }
202 }
203 }
204
205 return false;
206 }

References parseAddresses().

+ Here is the call graph for this function:

◆ fetchMailData()

ilMail::fetchMailData (   $a_row)
protected
Parameters
array|null
Returns
array|null

Definition at line 581 of file class.ilMail.php.

582 {
583 if(!is_array($a_row) || empty($a_row))
584 {
585 return null;
586 }
587
588 $a_row['attachments'] = unserialize(stripslashes($a_row['attachments']));
589 $a_row['m_type'] = unserialize(stripslashes($a_row['m_type']));
590 $a_row['tpl_ctx_params'] = (array)(@json_decode($a_row['tpl_ctx_params'], true));
591
592 return $a_row;
593 }

Referenced by getMail(), getMailsOfFolder(), getNextMail(), getPreviousMail(), and getSavedData().

+ Here is the caller graph for this function:

◆ getCachedUserInstance()

static ilMail::getCachedUserInstance (   $a_usr_id)
staticprotected
Parameters
int$a_usr_id
Returns
ilObjUser

Definition at line 1714 of file class.ilMail.php.

1715 {
1716 if(isset(self::$userInstances[$a_usr_id]))
1717 {
1718 return self::$userInstances[$a_usr_id];
1719 }
1720
1721 self::$userInstances[$a_usr_id] = new ilObjUser($a_usr_id);
1722 return self::$userInstances[$a_usr_id];
1723 }

Referenced by distributeMail(), and replacePlaceholders().

+ Here is the caller graph for this function:

◆ getCountRecipient()

ilMail::getCountRecipient (   $a_recipients,
  $a_only_email = true 
)
protected
Parameters
string$a_recipients
bool$a_only_email
Returns
int

Definition at line 1501 of file class.ilMail.php.

1502 {
1503 $counter = 0;
1504
1505 $recipients = $this->parseAddresses($a_recipients);
1506 foreach($recipients as $recipient)
1507 {
1508 if($a_only_email)
1509 {
1510 // Fixed mantis bug #5875
1511 if(ilObjUser::_lookupId($recipient->getMailbox() . '@' . $recipient->getHost()))
1512 {
1513 continue;
1514 }
1515
1516 // Addresses which aren't on the self::ILIAS_HOST host, and
1517 // which have a mailbox which does not start with '#',
1518 // are external e-mail addresses
1519 if($recipient->getHost() != self::ILIAS_HOST && substr($recipient->getMailbox(), 0, 1) != '#')
1520 {
1521 ++$counter;
1522 }
1523 }
1524 else
1525 {
1526 ++$counter;
1527 }
1528 }
1529
1530 return $counter;
1531 }
static _lookupId($a_user_str)
Lookup id by login.
$counter

References $counter, ilObjUser\_lookupId(), and parseAddresses().

Referenced by getCountRecipients().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCountRecipients()

ilMail::getCountRecipients (   $a_to,
  $a_cc,
  $a_bcc,
  $a_only_email = true 
)
protected
Parameters
string$a_to
string$a_cc
string$a_bcc
bool$a_only_email
Returns
int

Definition at line 1540 of file class.ilMail.php.

1541 {
1542 return
1543 $this->getCountRecipient($a_to, $a_only_email) +
1544 $this->getCountRecipient($a_cc, $a_only_email) +
1545 $this->getCountRecipient($a_bcc, $a_only_email);
1546 }
getCountRecipient($a_recipients, $a_only_email=true)

References getCountRecipient().

+ Here is the call graph for this function:

◆ getEmailRecipients()

ilMail::getEmailRecipients (   $a_recipients)
protected
Parameters
string$a_recipients
Returns
string

Definition at line 1552 of file class.ilMail.php.

1553 {
1554 $rcp = array();
1555
1556 $recipients = $this->parseAddresses($a_recipients);
1557 foreach($recipients as $recipient)
1558 {
1559 if(substr($recipient->getMailbox(), 0, 1) != '#' && $recipient->getHost() != self::ILIAS_HOST)
1560 {
1561 // Fixed mantis bug #5875
1562 if(ilObjUser::_lookupId($recipient->getMailbox() . '@' . $recipient->getHost()))
1563 {
1564 continue;
1565 }
1566
1567 $rcp[] = $recipient->getMailbox() . '@' . $recipient->getHost();
1568 }
1569 }
1570
1571 return implode(',', $rcp);
1572 }

References ilObjUser\_lookupId(), and parseAddresses().

+ Here is the call graph for this function:

◆ getMail()

ilMail::getMail (   $a_mail_id)
Parameters
int$a_mail_id
Returns
array

Definition at line 435 of file class.ilMail.php.

436 {
437 $res = $this->db->queryF("
438 SELECT * FROM {$this->table_mail}
439 WHERE user_id = %s AND mail_id = %s",
440 array('integer', 'integer'),
441 array($this->user_id, $a_mail_id));
442
443 $this->mail_data = $this->fetchMailData($this->db->fetchAssoc($res));
444
445 return $this->mail_data;
446 }
fetchMailData($a_row)

References $mail_data, $res, and fetchMailData().

+ Here is the call graph for this function:

◆ getMailObjectReferenceId()

ilMail::getMailObjectReferenceId ( )
Returns
int

Definition at line 267 of file class.ilMail.php.

268 {
270 }
$mail_obj_ref_id

References $mail_obj_ref_id.

◆ getMailsOfFolder()

ilMail::getMailsOfFolder (   $a_folder_id,
  $filter = array() 
)
Parameters
int$a_folder_idThe id of the folder
array$filterAn optional filter array
Returns
array

Definition at line 361 of file class.ilMail.php.

362 {
363 $output = array();
364
365 $query = "
366 SELECT sender_id, m_subject, mail_id, m_status, send_time FROM {$this->table_mail}
367 LEFT JOIN object_data ON obj_id = sender_id
368 WHERE user_id = %s AND folder_id = %s
369 AND ((sender_id > 0 AND sender_id IS NOT NULL AND obj_id IS NOT NULL) OR (sender_id = 0 OR sender_id IS NULL)) ";
370
371 if(isset($filter['status']) && strlen($filter['status']) > 0)
372 {
373 $query .= ' AND m_status = ' . $this->db->quote($filter['status'], 'text');
374 }
375
376 if(isset($filter['type']) && strlen($filter['type']) > 0)
377 {
378 $query .= ' AND ' . $this->db->like('m_type', 'text', '%%:"' . $filter['type'] . '"%%', false);
379 }
380
381 $query .= " ORDER BY send_time DESC";
382
383 $res = $this->db->queryF($query,
384 array('integer', 'integer'),
385 array($this->user_id, $a_folder_id)
386 );
387
388 while($row = $this->db->fetchAssoc($res))
389 {
390 $output[] = $this->fetchMailData($row);
391 }
392
393 return $output;
394 }
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output

References $output, $query, $res, $row, and fetchMailData().

Referenced by deleteMailsOfFolder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewDraftId()

ilMail::getNewDraftId (   $usrId,
  $folderId 
)
Parameters
int$usrId
int$folderId
Returns
int

Definition at line 600 of file class.ilMail.php.

601 {
602 $next_id = $this->db->nextId($this->table_mail);
603 $this->db->insert($this->table_mail, array(
604 'mail_id' => array('integer', $next_id),
605 'user_id' => array('integer', $usrId),
606 'folder_id' => array('integer', $folderId),
607 'sender_id' => array('integer', $usrId)
608 ));
609
610 return $next_id;
611 }

◆ getNextMail()

ilMail::getNextMail (   $a_mail_id)
Parameters
int$a_mail_id
Returns
array

Definition at line 338 of file class.ilMail.php.

339 {
340 $this->db->setLimit(1);
341
342 $res = $this->db->queryF("
343 SELECT b.* FROM {$this->table_mail} a
344 INNER JOIN {$this->table_mail} b ON b.folder_id = a.folder_id
345 AND b.user_id = a.user_id AND b.send_time < a.send_time
346 WHERE a.user_id = %s AND a.mail_id = %s ORDER BY b.send_time DESC",
347 array('integer', 'integer'),
348 array($this->user_id, $a_mail_id)
349 );
350
351 $this->mail_data = $this->fetchMailData($this->db->fetchAssoc($res));
352
353 return $this->mail_data;
354 }

References $mail_data, $res, and fetchMailData().

+ Here is the call graph for this function:

◆ getPreviousMail()

ilMail::getPreviousMail (   $a_mail_id)
Parameters
int$a_mail_id
Returns
array

Definition at line 316 of file class.ilMail.php.

317 {
318 $this->db->setLimit(1);
319
320 $res = $this->db->queryF("
321 SELECT b.* FROM {$this->table_mail} a
322 INNER JOIN {$this->table_mail} b ON b.folder_id = a.folder_id
323 AND b.user_id = a.user_id AND b.send_time > a.send_time
324 WHERE a.user_id = %s AND a.mail_id = %s ORDER BY b.send_time ASC",
325 array('integer', 'integer'),
326 array($this->user_id, $a_mail_id)
327 );
328
329 $this->mail_data = $this->fetchMailData($this->db->fetchAssoc($res));
330
331 return $this->mail_data;
332 }

References $mail_data, $res, and fetchMailData().

+ Here is the call graph for this function:

◆ getSavedData()

ilMail::getSavedData ( )
Returns
array

Definition at line 1099 of file class.ilMail.php.

1100 {
1101 $res = $this->db->queryF(
1102 "SELECT * FROM {$this->table_mail_saved} WHERE user_id = %s",
1103 array('integer'),
1104 array($this->user_id)
1105 );
1106
1107 $this->mail_data = $this->fetchMailData($this->db->fetchAssoc($res));
1108
1109 return $this->mail_data;
1110 }

References $mail_data, $res, and fetchMailData().

Referenced by savePostData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSaveInSentbox()

ilMail::getSaveInSentbox ( )
Returns
bool

Definition at line 250 of file class.ilMail.php.

251 {
252 return (bool)$this->save_in_sentbox;
253 }
$save_in_sentbox

References $save_in_sentbox.

◆ getUserIds()

ilMail::getUserIds (   $a_recipients)
protected
Parameters
string$a_recipientsrecipients seperated by ','
Returns
int[]

Definition at line 965 of file class.ilMail.php.

966 {
967 $usr_ids = array();
968
969 require_once 'Services/Mail/classes/Address/Type/class.ilMailAddressTypeFactory.php';
970 $recipients = $this->parseAddresses($a_recipients);
971 foreach($recipients as $recipient)
972 {
973 $address_type = ilMailAddressTypeFactory::getByPrefix($recipient);
974 $usr_ids = array_merge($usr_ids, $address_type->resolve());
975 }
976
977 return array_unique($usr_ids);
978 }

References ilMailAddressTypeFactory\getByPrefix(), and parseAddresses().

Referenced by distributeMail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ markRead()

ilMail::markRead ( array  $a_mail_ids)
Parameters
array$a_mail_ids
Returns
bool

Definition at line 452 of file class.ilMail.php.

453 {
454 $data = array();
455 $data_types = array();
456
457 $query = "UPDATE {$this->table_mail} SET m_status = %s WHERE user_id = %s ";
458 array_push($data_types, 'text', 'integer');
459 array_push($data, 'read', $this->user_id);
460
461 if(count($a_mail_ids) > 0)
462 {
463 $in = 'mail_id IN (';
464 $counter = 0;
465 foreach($a_mail_ids as $a_mail_id)
466 {
467 array_push($data, $a_mail_id);
468 array_push($data_types, 'integer');
469
470 if($counter > 0) $in .= ',';
471 $in .= '%s';
472 ++$counter;
473 }
474 $in .= ')';
475
476 $query .= ' AND ' . $in;
477 }
478
479 $this->db->manipulateF($query, $data_types, $data);
480
481 return true;
482 }
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37

References $counter, $data, $in, and $query.

◆ markUnread()

ilMail::markUnread ( array  $a_mail_ids)
Parameters
array$a_mail_ids
Returns
bool

Definition at line 488 of file class.ilMail.php.

489 {
490 $data = array();
491 $data_types = array();
492
493 $query = "UPDATE {$this->table_mail} SET m_status = %s WHERE user_id = %s ";
494 array_push($data_types, 'text', 'integer');
495 array_push($data, 'unread', $this->user_id);
496
497 if(count($a_mail_ids) > 0)
498 {
499 $in = 'mail_id IN (';
500 $counter = 0;
501 foreach($a_mail_ids as $a_mail_id)
502 {
503 array_push($data, $a_mail_id);
504 array_push($data_types, 'integer');
505
506 if($counter > 0) $in .= ',';
507 $in .= '%s';
508 ++$counter;
509 }
510 $in .= ')';
511
512 $query .= ' AND '.$in;
513 }
514
515 $this->db->manipulateF($query, $data_types, $data);
516
517 return true;
518 }

References $counter, $data, $in, and $query.

◆ moveMailsToFolder()

ilMail::moveMailsToFolder ( array  $a_mail_ids,
  $a_folder_id 
)
Parameters
array$a_mail_ids
int$a_folder_id
Returns
bool

Definition at line 525 of file class.ilMail.php.

526 {
527 $data = array();
528 $data_types = array();
529
530 $query = "UPDATE {$this->table_mail} SET folder_id = %s WHERE user_id = %s ";
531 array_push($data_types, 'text', 'integer');
532 array_push($data, $a_folder_id, $this->user_id);
533
534 if(count($a_mail_ids) > 0)
535 {
536 $in = 'mail_id IN (';
537 $counter = 0;
538 foreach($a_mail_ids as $a_mail_id)
539 {
540 array_push($data, $a_mail_id);
541 array_push($data_types, 'integer');
542
543 if($counter > 0) $in .= ',';
544 $in .= '%s';
545 ++$counter;
546 }
547 $in .= ')';
548
549 $query .= ' AND '.$in;
550 }
551
552 $this->db->manipulateF($query, $data_types, $data);
553
554 return true;
555 }

References $counter, $data, $in, and $query.

◆ parseAddresses()

ilMail::parseAddresses (   $addresses)
protected

Explode recipient string, allowed separators are ',' ';' ' ' Returns an array with recipient ilMailAddress instances.

Parameters
string$addresses
Returns
ilMailAddress[] An array with objects of type ilMailAddress

Definition at line 1471 of file class.ilMail.php.

1472 {
1473 if(strlen($addresses) > 0)
1474 {
1475 ilLoggerFactory::getLogger('mail')->debug(sprintf(
1476 "Started parsing of recipient string: %s", $addresses
1477 ));
1478 }
1479
1480 require_once 'Services/Mail/classes/Address/Parser/class.ilMailRfc822AddressParserFactory.php';
1482 $parsedAddresses = $parser->parse();
1483
1484 if(strlen($addresses) > 0)
1485 {
1486 ilLoggerFactory::getLogger('mail')->debug(sprintf(
1487 "Parsed addresses: %s", implode(',', array_map(function(ilMailAddress $address) {
1488 return $address->getMailbox() . '@' . $address->getHost();
1489 }, $parsedAddresses))
1490 ));
1491 }
1492
1493 return $parsedAddresses;
1494 }
$parser
Definition: BPMN2Parser.php:24
Class ilMailAddress.

References $parser, ilMailAddress\getHost(), ilLoggerFactory\getLogger(), ilMailAddress\getMailbox(), ilMailRfc822AddressParserFactory\getParser(), and sprintf.

Referenced by checkRecipients(), existsRecipient(), getCountRecipient(), getEmailRecipients(), and getUserIds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readMailObjectReferenceId()

ilMail::readMailObjectReferenceId ( )
protected

Read and set the mail object ref id (administration node)

Definition at line 258 of file class.ilMail.php.

259 {
260 require_once 'Services/Mail/classes/class.ilMailGlobalServices.php';
261 $this->mail_obj_ref_id = ilMailGlobalServices::getMailObjectRefId();
262 }
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable.

References ilMailGlobalServices\getMailObjectRefId().

+ Here is the call graph for this function:

◆ replacePlaceholders()

ilMail::replacePlaceholders (   $a_message,
  $a_user_id = 0,
  $replace_empty = true 
)
protected
Parameters
string$a_message
int$a_user_id
boolean$replace_empty
Returns
string

Definition at line 719 of file class.ilMail.php.

720 {
721 try
722 {
723 include_once 'Services/Mail/classes/class.ilMailFormCall.php';
724
726 {
727 require_once 'Services/Mail/classes/class.ilMailTemplateService.php';
729 }
730 else
731 {
732 require_once 'Services/Mail/classes/class.ilMailTemplateGenericContext.php';
733 $context = new ilMailTemplateGenericContext();
734 }
735
736 $user = $a_user_id > 0 ? self::getCachedUserInstance($a_user_id) : null;
737
738 require_once 'Services/Mail/classes/class.ilMailTemplatePlaceholderResolver.php';
739 $processor = new ilMailTemplatePlaceholderResolver($context, $a_message);
740 $a_message = $processor->resolve($user, ilMailFormCall::getContextParameters(), $replace_empty);
741 }
742 catch(Exception $e)
743 {
744 require_once './Services/Logging/classes/public/class.ilLoggerFactory.php';
745 ilLoggerFactory::getLogger('mail')->error(__METHOD__ . ' has been called with invalid context.');
746 }
747
748 return $a_message;
749 }

References getCachedUserInstance(), ilMailFormCall\getContextId(), ilMailFormCall\getContextParameters(), ilLoggerFactory\getLogger(), and ilMailTemplateService\getTemplateContextById().

Referenced by distributeMail(), and sendInternalMail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAttachments()

ilMail::saveAttachments (   $a_attachments)
Parameters
array$a_attachmentsAn array of attachments
Returns
bool

Definition at line 1451 of file class.ilMail.php.

1452 {
1453 $this->db->update($this->table_mail_saved,
1454 array(
1455 'attachments' => array('clob', serialize($a_attachments))
1456 ),
1457 array(
1458 'user_id' => array('integer', $this->user_id)
1459 )
1460 );
1461
1462 return true;
1463 }

◆ saveInSentbox()

ilMail::saveInSentbox (   $a_attachment,
  $a_rcp_to,
  $a_rcp_cc,
  $a_rcp_bcc,
  $a_type,
  $a_m_subject,
  $a_m_message 
)
protected

Stores a message in the sent bod of the current user.

Parameters
array$a_attachment
string$a_rcp_to
string$a_rcp_cc
string$a_rcp_bcc
string$a_type
string$a_m_subject
string$a_m_message
Returns
int mail id

Definition at line 1280 of file class.ilMail.php.

1281 {
1282 require_once 'Services/Mail/classes/class.ilMailbox.php';
1283
1284 $mbox = new ilMailbox($this->user_id);
1285 $sent_folder_id = $mbox->getSentFolder();
1286
1287 return $this->sendInternalMail(
1288 $sent_folder_id, $this->user_id, $a_attachment,
1289 $a_rcp_to,$a_rcp_cc, $a_rcp_bcc,
1290 'read', $a_type, 0,
1291 $a_m_subject, $a_m_message, $this->user_id, 0
1292 );
1293 }

References $a_type, and sendInternalMail().

+ Here is the call graph for this function:

◆ savePostData()

ilMail::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,
  $a_tpl_context_id = null,
  $a_tpl_ctx_params = array() 
)

save post data in table @access public

Parameters
int$a_user_id
array$a_attachments
string$a_rcp_to
string$a_rcp_cc
string$a_rcp_bcc
array$a_m_type
int$a_m_email
string$a_m_subject
string$a_m_message
int$a_use_placeholders
string | null$a_tpl_context_id
array | null$a_tpl_ctx_params
Returns
bool

Definition at line 1056 of file class.ilMail.php.

1061 {
1062 if(!$a_attachments) $a_attachments = NULL;
1063 if(!$a_rcp_to) $a_rcp_to = NULL;
1064 if(!$a_rcp_cc) $a_rcp_cc = NULL;
1065 if(!$a_rcp_bcc) $a_rcp_bcc = NULL;
1066 if(!$a_m_type) $a_m_type = NULL;
1067 if(!$a_m_email) $a_m_email = NULL;
1068 if(!$a_m_message) $a_m_message = NULL;
1069 if(!$a_use_placeholders) $a_use_placeholders = '0';
1070
1071 $this->db->replace(
1072 $this->table_mail_saved,
1073 array(
1074 'user_id' => array('integer', $this->user_id)
1075 ),
1076 array(
1077 'attachments' => array('clob', serialize($a_attachments)),
1078 'rcp_to' => array('clob', $a_rcp_to),
1079 'rcp_cc' => array('clob', $a_rcp_cc),
1080 'rcp_bcc' => array('clob', $a_rcp_bcc),
1081 'm_type' => array('text', serialize($a_m_type)),
1082 'm_email' => array('integer', $a_m_email),
1083 'm_subject' => array('text', $a_m_subject),
1084 'm_message' => array('clob', $a_m_message),
1085 'use_placeholders' => array('integer', $a_use_placeholders),
1086 'tpl_ctx_id' => array('text', $a_tpl_context_id),
1087 'tpl_ctx_params' => array('blob', json_encode((array)$a_tpl_ctx_params))
1088 )
1089 );
1090
1091 $this->getSavedData();
1092
1093 return true;
1094 }

References getSavedData().

+ Here is the call graph for this function:

◆ sendInternalMail()

ilMail::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,
  $a_tpl_context_id = null,
  $a_tpl_context_params = array() 
)

save mail in folder @access private

Parameters
integer$a_folder_id
integer$a_sender_id
array$a_attachments
string$a_rcp_to
string$a_rcp_cc
string$a_rcp_bcc
string$a_status
string$a_m_type
integer$a_m_email
string$a_m_subject
string$a_m_message
integer$a_user_id
integer$a_use_placeholders
string | null$a_tpl_context_id
array | null$a_tpl_context_params
Returns
integer mail_id

Definition at line 664 of file class.ilMail.php.

669 {
670 $a_user_id = $a_user_id ? $a_user_id : $this->user_id;
671
672 if($a_use_placeholders)
673 {
674 $a_m_message = $this->replacePlaceholders($a_m_message, $a_user_id);
675 }
676
677 if(!$a_user_id) $a_user_id = '0';
678 if(!$a_folder_id) $a_folder_id = '0';
679 if(!$a_sender_id) $a_sender_id = NULL;
680 if(!$a_attachments) $a_attachments = NULL;
681 if(!$a_rcp_to) $a_rcp_to = NULL;
682 if(!$a_rcp_cc) $a_rcp_cc = NULL;
683 if(!$a_rcp_bcc) $a_rcp_bcc = NULL;
684 if(!$a_status) $a_status = NULL;
685 if(!$a_m_type) $a_m_type = NULL;
686 if(!$a_m_email) $a_m_email = NULL;
687 if(!$a_m_subject) $a_m_subject = NULL;
688 if(!$a_m_message) $a_m_message = NULL;
689
690 $next_id = $this->db->nextId($this->table_mail);
691 $this->db->insert($this->table_mail, array(
692 'mail_id' => array('integer', $next_id),
693 'user_id' => array('integer', $a_user_id),
694 'folder_id' => array('integer', $a_folder_id),
695 'sender_id' => array('integer', $a_sender_id),
696 'attachments' => array('clob', serialize($a_attachments)),
697 'send_time' => array('timestamp', date('Y-m-d H:i:s', time())),
698 'rcp_to' => array('clob', $a_rcp_to),
699 'rcp_cc' => array('clob', $a_rcp_cc),
700 'rcp_bcc' => array('clob', $a_rcp_bcc),
701 'm_status' => array('text', $a_status),
702 'm_type' => array('text', serialize($a_m_type)),
703 'm_email' => array('integer', $a_m_email),
704 'm_subject' => array('text', $a_m_subject),
705 'm_message' => array('clob', $a_m_message),
706 'tpl_ctx_id' => array('text', $a_tpl_context_id),
707 'tpl_ctx_params' => array('blob', @json_encode((array)$a_tpl_context_params))
708 ));
709
710 return $next_id;
711 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())

References $user_id, date, and replacePlaceholders().

Referenced by distributeMail(), and saveInSentbox().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendMimeMail()

ilMail::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 (if enabled) starting a kind of background process

Parameters
string$a_rcp_to
string$a_rcp_cc
string$a_rcp_bcc
string$a_m_subject
string$a_m_message
array$a_attachments
bool$a_no_soap
Returns
array of saved data
Deprecated:
Should not be called from consumers, please use sendMail()

Definition at line 1369 of file class.ilMail.php.

1370 {
1371 require_once 'Services/Mail/classes/class.ilMimeMail.php';
1372
1373 $a_m_subject = self::getSubjectPrefix() . ' ' . $a_m_subject;
1374 $sender = $this->getMimeMailSender();
1375
1376 // #10854
1377 if($this->isSOAPEnabled() && !$a_no_soap)
1378 {
1379 require_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
1380 $soap_client = new ilSoapClient();
1381 $soap_client->setResponseTimeout(5);
1382 $soap_client->enableWSDL(true);
1383 $soap_client->init();
1384
1385 $attachments = array();
1386 $a_attachments = $a_attachments ? $a_attachments : array();
1387 foreach($a_attachments as $attachment)
1388 {
1389 $attachments[] = $this->mfile->getAbsolutePath($attachment);
1390 }
1391
1392 // mjansen: switched separator from "," to "#:#" because of mantis bug #6039
1393 $attachments = implode('#:#', $attachments);
1394 // mjansen: use "#:#" as leading delimiter
1395 if(strlen($attachments))
1396 {
1397 $attachments = "#:#" . $attachments;
1398 }
1399
1400 $soap_client->call('sendMail', array(
1401 session_id() . '::' . $_COOKIE['ilClientId'],
1402 $a_rcp_to,
1403 $a_rcp_cc,
1404 $a_rcp_bcc,
1405 is_array($sender) ? implode('#:#', $sender) : $sender,
1406 $a_m_subject,
1407 $a_m_message,
1408 $attachments
1409 ));
1410
1411 return true;
1412 }
1413 else
1414 {
1415 // send direct
1416 include_once "Services/Mail/classes/class.ilMimeMail.php";
1417
1418 $mmail = new ilMimeMail();
1419 $mmail->autoCheck(false);
1420 $mmail->From($sender);
1421 $mmail->To($a_rcp_to);
1422 $mmail->Subject($a_m_subject);
1423 $mmail->Body($a_m_message);
1424
1425 if($a_rcp_cc)
1426 {
1427 $mmail->Cc($a_rcp_cc);
1428 }
1429
1430 if($a_rcp_bcc)
1431 {
1432 $mmail->Bcc($a_rcp_bcc);
1433 }
1434
1435 if(is_array($a_attachments))
1436 {
1437 foreach($a_attachments as $attachment)
1438 {
1439 $mmail->Attach($this->mfile->getAbsolutePath($attachment), '', 'inline', $attachment);
1440 }
1441 }
1442
1443 $mmail->Send();
1444 }
1445 }
$_COOKIE['ilClientId']
Definition: BPMN2Parser.php:15
this class encapsulates the PHP mail() function.

References $_COOKIE.

Referenced by distributeMail().

+ Here is the caller graph for this function:

◆ setSaveInSentbox()

ilMail::setSaveInSentbox (   $a_save_in_sentbox)
Parameters
bool$a_save_in_sentbox

Definition at line 242 of file class.ilMail.php.

243 {
244 $this->save_in_sentbox = (bool)$a_save_in_sentbox;
245 }

◆ updateDraft()

ilMail::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,
  $a_tpl_context_id = null,
  $a_tpl_context_params = array() 
)

Definition at line 613 of file class.ilMail.php.

618 {
619 $this->db->update($this->table_mail,
620 array(
621 'folder_id' => array('integer', $a_folder_id),
622 'attachments' => array('clob', serialize($a_attachments)),
623 'send_time' => array('timestamp', date('Y-m-d H:i:s', time())),
624 'rcp_to' => array('clob', $a_rcp_to),
625 'rcp_cc' => array('clob', $a_rcp_cc),
626 'rcp_bcc' => array('clob', $a_rcp_bcc),
627 'm_status' => array('text', 'read'),
628 'm_type' => array('text', serialize($a_m_type)),
629 'm_email' => array('integer', $a_m_email),
630 'm_subject' => array('text', $a_m_subject),
631 'm_message' => array('clob', $a_m_message),
632 'use_placeholders' => array('integer', $a_use_placeholders),
633 'tpl_ctx_id' => array('text', $a_tpl_context_id),
634 'tpl_ctx_params' => array('blob', @json_encode((array)$a_tpl_context_params))
635 ),
636 array(
637 'mail_id' => array('integer', $a_draft_id)
638 )
639 );
640
641 return $a_draft_id;
642 }

References date.

◆ validateRecipients()

ilMail::validateRecipients (   $a_rcp_to,
  $a_rcp_cc,
  $a_rcp_bc 
)
Parameters
string$a_rcp_to
string$a_rcp_cc
string$a_rcp_bc
Returns
array Returns an empty array if there is no validation issue

Definition at line 1247 of file class.ilMail.php.

1248 {
1249 try
1250 {
1251 $errors = array();
1252 $errors = array_merge($errors, $this->checkRecipients($a_rcp_to));
1253 $errors = array_merge($errors, $this->checkRecipients($a_rcp_cc));
1254 $errors = array_merge($errors, $this->checkRecipients($a_rcp_bc));
1255
1256 if(count($errors) > 0)
1257 {
1258 return array_merge(array(array('mail_following_rcp_not_valid')), $errors);
1259 }
1260 }
1261 catch(ilMailException $e)
1262 {
1263 return array(array('mail_generic_rcp_error', $e->getMessage()));
1264 }
1265
1266 return array();
1267 }
checkRecipients($a_recipients)
Check if recipients are valid.

References $errors, and checkRecipients().

+ Here is the call graph for this function:

Field Documentation

◆ $appendInstallationSignature

ilMail::$appendInstallationSignature = false
protected

Definition at line 103 of file class.ilMail.php.

Referenced by appendInstallationSignature().

◆ $db

ilMail::$db
protected

Definition at line 75 of file class.ilMail.php.

◆ $lng

ilMail::$lng
protected

Definition at line 72 of file class.ilMail.php.

◆ $mail_data

ilMail::$mail_data = array()
protected

◆ $mail_obj_ref_id

ilMail::$mail_obj_ref_id
protected

Definition at line 96 of file class.ilMail.php.

Referenced by getMailObjectReferenceId().

◆ $mail_options

ilMail::$mail_options
protected

Definition at line 81 of file class.ilMail.php.

◆ $mail_to_global_roles

ilMail::$mail_to_global_roles = 0
protected

Definition at line 102 of file class.ilMail.php.

◆ $mfile

ilMail::$mfile
protected

Definition at line 78 of file class.ilMail.php.

◆ $properties

ilMail::$properties = array()
protected

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

◆ $save_in_sentbox

ilMail::$save_in_sentbox
protected

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

Referenced by getSaveInSentbox().

◆ $soap_enabled

ilMail::$soap_enabled = true
protected

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

◆ $table_mail

ilMail::$table_mail
protected

Definition at line 87 of file class.ilMail.php.

◆ $table_mail_saved

ilMail::$table_mail_saved
protected

Definition at line 90 of file class.ilMail.php.

◆ $user_id

ilMail::$user_id

Definition at line 84 of file class.ilMail.php.

Referenced by sendInternalMail().

◆ $userInstances

ilMail::$userInstances = array()
staticprotected

Definition at line 112 of file class.ilMail.php.

◆ ILIAS_HOST


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