Public Member Functions | |
ilMail ($a_user_id) | |
Constructor setup an mail object public. | |
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 | |
getMailObjectReferenceId () | |
get mail object reference id | |
getMailsOfFolder ($a_folder_id) | |
get all mails of a specific folder public | |
getMailCounterData () | |
get mail counter data returns data array with indexes "total","read","unread" public | |
getMail ($a_mail_id) | |
get data of one mail public | |
markRead ($a_mail_ids) | |
mark mails as read public | |
markUnread ($a_mail_ids) | |
mark mails as unread public | |
moveMailsToFolder ($a_mail_ids, $a_folder_id) | |
move mail to folder public | |
deleteMails ($a_mail_ids) | |
delete mail public | |
fetchMailData ($a_row) | |
fetch all query data from table mail public | |
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) | |
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) | |
save mail in folder private | |
distributeMail ($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_subject, $a_message, $a_attachments, $sent_mail_id, $a_type, $a_action) | |
send internal message to recipients private | |
getUserIds ($a_recipients) | |
get user_ids | |
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 | |
getEmailsOfRecipients ($a_rcp) | |
get email addresses of recipients public | |
checkRecipients ($a_recipients, $a_type) | |
check if recipients are valid public | |
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) | |
save post data in table public | |
getSavedData () | |
get saved data public | |
sendMail ($a_rcp_to, $a_rcp_cc, $a_rcp_bc, $a_m_subject, $a_m_message, $a_attachment, $a_type) | |
send external mail using class.ilMimeMail.php | |
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 | |
addFullname ($a_email) | |
add user fullname to mail 'From' | |
sendMimeMail ($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject, $a_m_message, $a_attachments) | |
send mime mail using class.ilMimeMail.php All external mails are send to SOAP::sendMail starting a kind of background process | |
getEmailOfSender () | |
get email of sender public | |
saveAttachments ($a_attachments) | |
set attachments | |
getAttachments () | |
get attachments public | |
explodeRecipients ($a_recipients) | |
explode recipient string allowed seperators are ',' ';' ' ' private | |
__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) | |
Data Fields | |
$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 | |
$soap_enabled = true |
Definition at line 35 of file class.ilMail.php.
ilMail::__checkSystemRecipients | ( | &$ | a_rcp_to | ) |
Definition at line 1299 of file class.ilMail.php.
References ilObjUser::_getAllUserLogins().
Referenced by sendMail().
{ if (preg_match("/@all/",$a_rcp_to)) { // GET ALL LOGINS $all = ilObjUser::_getAllUserLogins($this->ilias); $a_rcp_to = preg_replace("/@all/",implode(',',$all),$a_rcp_to); } return; }
ilMail::__getCountRecipient | ( | $ | rcp, | |
$ | a_only_email = true | |||
) |
Definition at line 1240 of file class.ilMail.php.
References $counter, and explodeRecipients().
Referenced by __getCountRecipients().
{ $counter = 0; foreach ($this->explodeRecipients($rcp) as $to) { if ($a_only_email) { if (strpos($to,'@')) { ++$counter; } } else { ++$counter; } } return $counter; }
ilMail::__getCountRecipients | ( | $ | a_to, | |
$ | a_cc, | |||
$ | a_bcc, | |||
$ | a_only_email = true | |||
) |
Definition at line 1263 of file class.ilMail.php.
References __getCountRecipient().
Referenced by sendMail().
{ return $this->__getCountRecipient($a_to,$a_only_email) + $this->__getCountRecipient($a_cc,$a_only_email) + $this->__getCountRecipient($a_bcc,$a_only_email); }
ilMail::__getEmailRecipients | ( | $ | a_rcp | ) |
Definition at line 1270 of file class.ilMail.php.
References explodeRecipients().
Referenced by sendMail().
{ foreach ($this->explodeRecipients($a_rcp) as $to) { if(strpos($to,'@')) { $rcp[] = $to; } } return implode(',',$rcp ? $rcp : array()); }
ilMail::__prependMessage | ( | $ | a_m_message, | |
$ | rcp_to, | |||
$ | rcp_cc | |||
) |
Definition at line 1282 of file class.ilMail.php.
{ $inst_name = $this->ilias->getSetting("inst_name") ? $this->ilias->getSetting("inst_name") : "ILIAS 3"; $message = $inst_name." To:".$rcp_to."\n"; if ($rcp_cc) { $message .= "Cc: ".$rcp_cc; } $message .= "\n\n"; $message .= $a_m_message; return $message; }
ilMail::__substituteRecipients | ( | $ | a_rcp, | |
$ | direction | |||
) |
Definition at line 1311 of file class.ilMail.php.
References explodeRecipients(), and loginExists().
Referenced by distributeMail(), and sendMail().
{ $new_name = array(); $tmp_names = $this->explodeRecipients($a_rcp); foreach($tmp_names as $name) { if(strpos($name,"#") === 0) { $new_name[] = $name; continue; } switch($direction) { case "substitute": if(strpos($name,"@") and loginExists($name)) { $new_name[] = preg_replace("/@/","�#�",$name); } else { $new_name[] = $name; } break; case "resubstitute": if(stristr($name,"�#�")) { $new_name[] = preg_replace("/�#�/","@",$name); } else { $new_name[] = $name; } break; } } return implode(",",$new_name); }
ilMail::addFullname | ( | $ | a_email | ) |
add user fullname to mail 'From'
string | email of sender |
Definition at line 1077 of file class.ilMail.php.
References ilMimeMail::_mimeEncode().
Referenced by sendMimeMail().
{ include_once 'classes/class.ilMimeMail.php'; global $ilUser; return ilMimeMail::_mimeEncode($ilUser->getFullname()).'<'.$a_email.'>'; }
ilMail::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
string | rcp_to | |
string | rcp_cc | |
string | rcp_bcc | |
string | m_subject | |
string | m_message |
Definition at line 715 of file class.ilMail.php.
Referenced by sendMail().
{ $error_message = ''; if (empty($a_m_subject)) { $error_message .= $error_message ? "<br>" : ''; $error_message .= $this->lng->txt("mail_add_subject"); } if (empty($a_rcp_to)) { $error_message .= $error_message ? "<br>" : ''; $error_message .= $this->lng->txt("mail_add_recipient"); } return $error_message; }
ilMail::checkRecipients | ( | $ | a_recipients, | |
$ | a_type | |||
) |
check if recipients are valid public
string | string with login names or group names (start with #) |
Definition at line 794 of file class.ilMail.php.
References $rbacreview, $rbacsystem, $user_id, explodeRecipients(), ilObjUser::getUserIdByLogin(), ilUtil::groupNameExists(), and ilUtil::is_email().
Referenced by sendMail().
{ global $rbacsystem,$rbacreview; $wrong_rcps = ''; $tmp_rcp = $this->explodeRecipients($a_recipients); foreach ($tmp_rcp as $rcp) { if (empty($rcp)) { continue; } // NO GROUP if (substr($rcp,0,1) != '#') { // ALL RECIPIENTS MUST EITHER HAVE A VALID LOGIN OR A VALID EMAIL if (!ilObjUser::getUserIdByLogin(addslashes($rcp)) and !ilUtil::is_email($rcp)) { $wrong_rcps .= "<BR/>".$rcp; continue; } // CHECK IF USER CAN RECEIVE MAIL if ($user_id = ilObjUser::getUserIdByLogin(addslashes($rcp))) { if(!$rbacsystem->checkAccessOfUser($user_id, "mail_visible", $this->getMailObjectReferenceId())) { $wrong_rcps .= "<BR/>".$rcp." (".$this->lng->txt("user_cant_receive_mail").")"; continue; } } } elseif (ilUtil::groupNameExists(addslashes(substr($rcp,1)))) { continue; } elseif(!$rbacreview->roleExists(addslashes(substr($rcp,1)))) { $wrong_rcps .= "<BR/>".$rcp." (".$this->lng->txt("mail_no_valid_group_role").")"; continue; } } return $wrong_rcps; }
ilMail::deleteMails | ( | $ | a_mail_ids | ) |
delete mail public
array | mail ids |
Definition at line 437 of file class.ilMail.php.
References $id, $query, and $res.
Referenced by sendMail().
{ foreach ($a_mail_ids as $id) { $query = "DELETE FROM $this->table_mail ". "WHERE user_id = '".$this->user_id."' ". "AND mail_id = '".$id."'"; $res = $this->ilias->db->query($query); $this->mfile->deassignAttachmentFromDirectory($id); } return true; }
ilMail::distributeMail | ( | $ | a_rcp_to, | |
$ | a_rcp_cc, | |||
$ | a_rcp_bcc, | |||
$ | a_subject, | |||
$ | a_message, | |||
$ | a_attachments, | |||
$ | sent_mail_id, | |||
$ | a_type, | |||
$ | a_action | |||
) |
send internal message to recipients private
string | to | |
string | cc | |
string | bcc | |
string | subject | |
string | message | |
array | attachments | |
integer | id of mail which is stored in sentbox | |
array | 'normal' and/or 'system' and/or 'email' |
Definition at line 575 of file class.ilMail.php.
References $id, $mbox, __substituteRecipients(), ilObjUser::_lookupEmail(), getUserIds(), sendInternalMail(), and sendMimeMail().
Referenced by sendMail().
{ include_once "classes/class.ilMailbox.php"; include_once "./classes/class.ilObjUser.php"; // REPLACE ALL LOGIN NAMES WITH '@' BY ANOTHER CHARACTER $a_rcp_to = $this->__substituteRecipients($a_rcp_to,"resubstitute"); $a_rcp_cc = $this->__substituteRecipients($a_rcp_cc,"resubstitute"); $a_rcp_bc = $this->__substituteRecipients($a_rcp_bc,"resubstitute"); $as_email = array(); $mbox =& new ilMailbox(); $rcp_ids = $this->getUserIds(trim($a_rcp_to).",".trim($a_rcp_cc).",".trim($a_rcp_bcc)); foreach($rcp_ids as $id) { $tmp_mail_options =& new ilMailOptions($id); // CONTINUE IF USER WNATS HIS MAIL SEND TO EMAIL if ($tmp_mail_options->getIncomingType() == $this->mail_options->EMAIL) { $as_email[] = $id; continue; } if ($tmp_mail_options->getIncomingType() == $this->mail_options->BOTH) { $as_email[] = $id; } if ($a_action == 'system') { $inbox_id = 0; } else { $mbox->setUserId($id); $inbox_id = $mbox->getInboxFolder(); } $mail_id = $this->sendInternalMail($inbox_id,$this->user_id, $a_attachments,$a_rcp_to, $a_rcp_cc,'','unread',$a_type, 0,$a_subject,$a_message,$id); if ($a_attachments) { $this->mfile->assignAttachmentsToDirectory($mail_id,$sent_mail_id,$a_attachments); } } // SEND EMAIL TO ALL USERS WHO DECIDED 'email' or 'both' $to = array(); $bcc = array(); if (count($as_email) == 1) { $to[] = ilObjUser::_lookupEmail($as_email[0]); } else { foreach ($as_email as $id) { $bcc[] = ilObjUser::_lookupEmail($id); } } if(count($to) > 0 || count($bcc) > 0) { $this->sendMimeMail(implode(',',$to),'',implode(',',$bcc),$a_subject,$a_message,$a_attachments); } return true; }
ilMail::enableSOAP | ( | $ | a_status | ) |
Definition at line 171 of file class.ilMail.php.
{ $this->soap_enabled = $a_status; }
ilMail::explodeRecipients | ( | $ | a_recipients | ) |
explode recipient string allowed seperators are ',' ';' ' ' private
Definition at line 1220 of file class.ilMail.php.
Referenced by __getCountRecipient(), __getEmailRecipients(), __substituteRecipients(), checkRecipients(), getEmailsOfRecipients(), and getUserIds().
{ $a_recipients = trim($a_recipients); // WHITESPACE IS NOT ALLOWED AS SEPERATOR #$a_recipients = preg_replace("/ /",",",$a_recipients); $a_recipients = preg_replace("/;/",",",$a_recipients); foreach(explode(',',$a_recipients) as $tmp_rec) { if($tmp_rec) { $rcps[] = trim($tmp_rec); } } return is_array($rcps) ? $rcps : array(); }
ilMail::fetchMailData | ( | $ | a_row | ) |
fetch all query data from table mail public
object | object of query |
Definition at line 458 of file class.ilMail.php.
Referenced by getMail(), getMailsOfFolder(), and getSavedData().
{ return array( "mail_id" => $a_row->mail_id, "user_id" => $a_row->user_id, "folder_id" => $a_row->folder_id, "sender_id" => $a_row->sender_id, "attachments" => unserialize(stripslashes($a_row->attachments)), "send_time" => $a_row->send_time, "rcp_to" => stripslashes($a_row->rcp_to), "rcp_cc" => stripslashes($a_row->rcp_cc), "rcp_bcc" => stripslashes($a_row->rcp_bcc), "m_status" => $a_row->m_status, "m_type" => unserialize(stripslashes($a_row->m_type)), "m_email" => $a_row->m_email, "m_subject" => stripslashes($a_row->m_subject), "m_message" => stripslashes($a_row->m_message), "import_name" => stripslashes($a_row->import_name)); }
ilMail::getAttachments | ( | ) |
get attachments public
Definition at line 1209 of file class.ilMail.php.
{ return $this->mail_data["attachments"] ? $this->mail_data["attachments"] : array(); }
ilMail::getEmailOfSender | ( | ) |
get email of sender public
Definition at line 1172 of file class.ilMail.php.
References $umail, and ilUtil::is_email().
Referenced by sendMail(), and sendMimeMail().
{ $umail = new ilObjUser($this->user_id); $sender = $umail->getEmail(); if (ilUtil::is_email($sender)) { return $sender; } else { return ''; } }
ilMail::getEmailsOfRecipients | ( | $ | a_rcp | ) |
get email addresses of recipients public
string | string with login names or group names (start with #) or email address |
Definition at line 740 of file class.ilMail.php.
References $id, $ref_id, $tmp_user, ilObject::_getAllReferences(), ilObjGroup::_lookupIdByTitle(), explodeRecipients(), ilObjectFactory::getInstanceByRefId(), and ilObjUser::getUserIdByLogin().
{ $addresses = array(); $tmp_rcp = $this->explodeRecipients($a_rcp); foreach ($tmp_rcp as $rcp) { // NO GROUP if (substr($rcp,0,1) != '#') { if (strpos($rcp,'@')) { $addresses[] = $rcp; continue; } if ($id = ilObjUser::getUserIdByLogin(addslashes($rcp))) { $tmp_user = new ilObjUser($id); $addresses[] = $tmp_user->getEmail(); continue; } } else { // GROUP THINGS include_once("./classes/class.ilObjectFactory.php"); include_once('./classes/class.ilObjGroup.php'); // Fix foreach(ilObjGroup::_getAllReferences(ilObjGroup::_lookupIdByTitle(addslashes(substr($tmp_names[$i],1)))) as $ref_id) { $grp_object = ilObjectFactory::getInstanceByRefId($ref_id); break; } // GET EMAIL OF MEMBERS AND STORE THEM IN $addresses foreach ($grp_object->getGroupMemberIds() as $id) { $tmp_user = new ilObjUser($id); $addresses[] = $tmp_user->getEmail(); } } } return $addresses; }
ilMail::getMail | ( | $ | a_mail_id | ) |
get data of one mail public
int | mail_id |
Definition at line 356 of file class.ilMail.php.
References $query, and fetchMailData().
{ $query = "SELECT * FROM $this->table_mail ". "WHERE user_id = $this->user_id ". "AND mail_id = '".$a_mail_id."'"; $this->mail_data = $this->fetchMailData($this->ilias->db->getRow($query,DB_FETCHMODE_OBJECT)); return $this->mail_data; }
ilMail::getMailCounterData | ( | ) |
get mail counter data returns data array with indexes "total","read","unread" public
Definition at line 342 of file class.ilMail.php.
{ return is_array($this->mail_counter) ? $this->mail_counter : array( "total" => 0, "read" => 0, "unread" => 0); }
ilMail::getMailObjectReferenceId | ( | ) |
get mail object reference id
Definition at line 287 of file class.ilMail.php.
{
return $this->mail_obj_ref_id;
}
ilMail::getMailsOfFolder | ( | $ | a_folder_id | ) |
get all mails of a specific folder public
integer | id of folder |
Definition at line 298 of file class.ilMail.php.
References $output, $query, $res, $row, fetchMailData(), and ilObjectFactory::ObjectIdExists().
{ $this->mail_counter = array(); $this->mail_counter["read"] = 0; $this->mail_counter["unread"] = 0; $query = "SELECT * FROM $this->table_mail ". "WHERE user_id = $this->user_id ". "AND folder_id = '".$a_folder_id."' ORDER BY send_time DESC"; $res = $this->ilias->db->query($query); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { if($row->sender_id and !ilObjectFactory::ObjectIdExists($row->sender_id)) { continue; } $tmp = $this->fetchMailData($row); if ($tmp["m_status"] == 'read') { ++$this->mail_counter["read"]; } if ($tmp["m_status"] == 'unread') { ++$this->mail_counter["unread"]; } $output[] = $tmp; } $this->mail_counter["total"] = count($output); return $output ? $output : array(); }
ilMail::getSavedData | ( | ) |
get saved data public
Definition at line 893 of file class.ilMail.php.
References $query, and fetchMailData().
{ $query = "SELECT * FROM $this->table_mail_saved ". "WHERE user_id = '".$this->user_id."'"; $this->mail_data = $this->fetchMailData($this->ilias->db->getRow($query,DB_FETCHMODE_OBJECT)); return $this->mail_data; }
ilMail::getSaveInSentbox | ( | ) |
Definition at line 190 of file class.ilMail.php.
Referenced by sendMail().
{
return $this->save_in_sentbox;
}
ilMail::getUserIds | ( | $ | a_recipients | ) |
get user_ids
string | recipients seperated by ',' |
Definition at line 655 of file class.ilMail.php.
References $id, $rbacreview, $ref_id, $role_id, ilObject::_getAllReferences(), ilObjGroup::_lookupIdByTitle(), explodeRecipients(), ilObjectFactory::getInstanceByRefId(), ilObjUser::getUserIdByLogin(), and ilUtil::groupNameExists().
Referenced by distributeMail().
{ global $rbacreview; $tmp_names = $this->explodeRecipients($a_recipients); $ids = array(); for ($i = 0;$i < count($tmp_names); $i++) { if (substr($tmp_names[$i],0,1) == '#') { if(ilUtil::groupNameExists(addslashes(substr($tmp_names[$i],1)))) { include_once("./classes/class.ilObjectFactory.php"); include_once('./classes/class.ilObjGroup.php'); foreach(ilObject::_getAllReferences(ilObjGroup::_lookupIdByTitle(addslashes(substr($tmp_names[$i],1)))) as $ref_id) { $grp_object = ilObjectFactory::getInstanceByRefId($ref_id); break; } // STORE MEMBER IDS IN $ids foreach ($grp_object->getGroupMemberIds() as $id) { $ids[] = $id; } } // is role: get role ids elseif($role_id = $rbacreview->roleExists(addslashes(substr($tmp_names[$i],1)))) { foreach($rbacreview->assignedUsers($role_id) as $usr_id) { $ids[] = $usr_id; } } } else if (!empty($tmp_names[$i])) { if ($id = ilObjUser::getUserIdByLogin(addslashes($tmp_names[$i]))) { $ids[] = $id; } # else if ($id = ilObjUser::getUserIdByEmail(addslashes($tmp_names[$i]))) # { # $ids[] = $id; # } } } return array_unique($ids); }
ilMail::ilMail | ( | $ | a_user_id | ) |
Constructor setup an mail object public.
integer | user_id |
Definition at line 138 of file class.ilMail.php.
References $ilias, $lng, readMailObjectReferenceId(), and setSaveInSentbox().
Referenced by ilFormatMail::ilFormatMail().
{ require_once "classes/class.ilFileDataMail.php"; require_once "classes/class.ilMailOptions.php"; global $ilias, $lng; $lng->loadLanguageModule("mail"); // Initiate variables $this->ilias =& $ilias; $this->lng =& $lng; $this->table_mail = 'mail'; $this->table_mail_saved = 'mail_saved'; $this->user_id = $a_user_id; $this->mfile =& new ilFileDataMail($this->user_id); $this->mail_options =& new ilMailOptions($a_user_id); // DEFAULT: sent mail aren't stored insentbox of user. $this->setSaveInSentbox(false); // GET REFERENCE ID OF MAIL OBJECT $this->readMailObjectReferenceId(); }
ilMail::isSOAPEnabled | ( | ) |
Definition at line 175 of file class.ilMail.php.
Referenced by sendMimeMail().
{ if(!extension_loaded('curl')) { return false; } return (bool) $this->soap_enabled; }
ilMail::markRead | ( | $ | a_mail_ids | ) |
mark mails as read public
array | mail ids |
Definition at line 373 of file class.ilMail.php.
ilMail::markUnread | ( | $ | a_mail_ids | ) |
mark mails as unread public
array | mail ids |
Definition at line 394 of file class.ilMail.php.
ilMail::moveMailsToFolder | ( | $ | a_mail_ids, | |
$ | a_folder_id | |||
) |
move mail to folder public
array | mail ids | |
int | folder_id |
Definition at line 416 of file class.ilMail.php.
ilMail::readMailObjectReferenceId | ( | ) |
read and set mail object id private
Definition at line 259 of file class.ilMail.php.
References $query, $res, and $row.
Referenced by ilMail().
{ // mail settings id is set by a constant in ilias.ini. Keep the select for some time until everyone has updated his ilias.ini if (!MAIL_SETTINGS_ID) { $query = "SELECT object_reference.ref_id FROM object_reference,tree,object_data ". "WHERE tree.parent = '".SYSTEM_FOLDER_ID."' ". "AND object_data.type = 'mail' ". "AND object_reference.ref_id = tree.child ". "AND object_reference.obj_id = object_data.obj_id"; $res = $this->ilias->db->query($query); while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) { $this->mail_obj_ref_id = $row["ref_id"]; } } else { $this->mail_obj_ref_id = MAIL_SETTINGS_ID; } }
ilMail::saveAttachments | ( | $ | a_attachments | ) |
set attachments
array | array of attachments public |
Definition at line 1193 of file class.ilMail.php.
ilMail::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
array | attachments | |
string | to | |
string | cc | |
string | bcc | |
string | type | |
string | subject | |
string | message public |
Definition at line 1058 of file class.ilMail.php.
References $mbox, and sendInternalMail().
Referenced by sendMail().
{ include_once "classes/class.ilMailbox.php"; $mbox = new ilMailbox($this->user_id); $sent_id = $mbox->getSentFolder(); return $this->sendInternalMail($sent_id,$this->user_id,$a_attachment,$a_rcp_to,$a_rcp_cc, $a_rcp_bcc,'read',$a_type,$a_as_email,$a_m_subject,$a_m_message,$this->user_id); }
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 | |||
) |
save post data in table public
int | user_id | |
array | attachments | |
string | to | |
string | cc | |
string | bcc | |
array | type of mail (system,normal,email) | |
int | as email (1,0) | |
string | subject | |
string | message |
Definition at line 858 of file class.ilMail.php.
{ $query = "DELETE FROM $this->table_mail_saved ". "WHERE user_id = '".$this->user_id."'"; $res = $this->ilias->db->query($query); $query = "INSERT INTO $this->table_mail_saved ". "SET user_id = '".$a_user_id."',". "attachments = '".addslashes(serialize($a_attachments))."',". "rcp_to = '".addslashes($a_rcp_to)."',". "rcp_cc = '".addslashes($a_rcp_cc)."',". "rcp_bcc = '".addslashes($a_rcp_bcc)."',". "m_type = '".addslashes(serialize($a_m_type))."',". "m_email = '',". "m_subject = '".addslashes($a_m_subject)."',". "m_message = '".addslashes($a_m_message)."'"; $res = $this->ilias->db->query($query); return true; }
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 | |||
) |
save mail in folder private
integer | id of folder | |
integer | sender_id | |
array | attachments | |
string | to | |
string | cc | |
string | bcc | |
string | status | |
string | type of mail (system,normal) | |
integer | as email (1,0) | |
string | subject | |
string | message | |
integer | user_id |
Definition at line 526 of file class.ilMail.php.
References $query, $res, and $row.
Referenced by distributeMail(), and saveInSentbox().
{ $a_user_id = $a_user_id ? $a_user_id : $this->user_id; $query = "INSERT INTO $this->table_mail ". "SET user_id = '".$a_user_id."',". "folder_id = '".$a_folder_id."',". "sender_id = '".$a_sender_id."',". "attachments = '".addslashes(serialize($a_attachments))."',". "send_time = now(),". "rcp_to = '".addslashes($a_rcp_to)."',". "rcp_cc = '".addslashes($a_rcp_cc)."',". "rcp_bcc = '".addslashes($a_rcp_bcc)."',". "m_status = '".$a_status."',". "m_type = '".addslashes(serialize($a_m_type))."',". "m_email = '".$a_m_email."',". "m_subject = '".addslashes($a_m_subject)."',". "m_message = '".addslashes($a_m_message)."'"; $res = $this->ilias->db->query($query); $query = "SELECT LAST_INSERT_ID() as id"; $row = $this->ilias->db->getRow($query,DB_FETCHMODE_ASSOC); return $row["id"]; }
ilMail::sendMail | ( | $ | a_rcp_to, | |
$ | a_rcp_cc, | |||
$ | a_rcp_bc, | |||
$ | a_m_subject, | |||
$ | a_m_message, | |||
$ | a_attachment, | |||
$ | a_type | |||
) |
send external mail using class.ilMimeMail.php
string | to | |
string | cc | |
string | bcc | |
string | subject | |
string | message | |
array | attachments | |
array | type (normal and/or system and/or email) | |
integer | also as email (0,1) public |
Definition at line 916 of file class.ilMail.php.
References $lng, $rbacsystem, __checkSystemRecipients(), __getCountRecipients(), __getEmailRecipients(), __substituteRecipients(), checkMail(), checkRecipients(), deleteMails(), distributeMail(), getEmailOfSender(), getSaveInSentbox(), saveInSentbox(), and sendMimeMail().
{ global $lng,$rbacsystem; $error_message = ''; $message = ''; if (in_array("system",$a_type)) { $this->__checkSystemRecipients($a_rcp_to); $a_type = array('system'); } if ($a_attachment) { if (!$this->mfile->checkFilesExist($a_attachment)) { return "YOUR LIST OF ATTACHMENTS IS NOT VALID, PLEASE EDIT THE LIST"; } } // CHECK NECESSARY MAIL DATA FOR ALL TYPES if ($error_message = $this->checkMail($a_rcp_to,$a_rcp_cc,$a_rcp_bc,$a_m_subject,$a_m_message,$a_type)) { return $error_message; } // check recipients if ($error_message = $this->checkRecipients($a_rcp_to,$a_type)) { $message .= $error_message; } if ($error_message = $this->checkRecipients($a_rcp_cc,$a_type)) { $message .= $error_message; } if ($error_message = $this->checkRecipients($a_rcp_bc,$a_type)) { $message .= $error_message; } // if there was an error if (!empty($message)) { return $this->lng->txt("mail_following_rcp_not_valid").$message; } // CHECK FOR SYSTEM MAIL if (in_array('system',$a_type)) { if (!empty($a_attachment)) { return $lng->txt("mail_no_attach_allowed"); } } // REPLACE ALL LOGIN NAMES WITH '@' BY ANOTHER CHARACTER $a_rcp_to = $this->__substituteRecipients($a_rcp_to,"substitute"); $a_rcp_cc = $this->__substituteRecipients($a_rcp_cc,"substitute"); $a_rcp_bc = $this->__substituteRecipients($a_rcp_bc,"substitute"); // COUNT EMAILS $c_emails = $this->__getCountRecipients($a_rcp_to,$a_rcp_cc,$a_rcp_bc,true); $c_rcp = $this->__getCountRecipients($a_rcp_to,$a_rcp_cc,$a_rcp_bc,false); if (count($c_emails)) { if (!$this->getEmailOfSender()) { return $lng->txt("mail_check_your_email_addr"); } } // ACTIONS FOR ALL TYPES // save mail in sent box $sent_id = $this->saveInSentbox($a_attachment,$a_rcp_to,$a_rcp_cc,$a_rcp_bc,$a_type, $a_m_subject,$a_m_message); if ($a_attachment) { $this->mfile->assignAttachmentsToDirectory($sent_id,$sent_id); // ARE THERE INTERNAL MAILS if ($c_emails < $c_rcp) { if ($error = $this->mfile->saveFiles($sent_id,$a_attachment)) { return $error; } } } // FILTER EMAILS // IF EMAIL RECIPIENT if ($c_emails) { if (!$rbacsystem->checkAccess("smtp_mail",$this->getMailObjectReferenceId())) { return $lng->txt("mail_no_permissions_write_smtp"); } $this->sendMimeMail($this->__getEmailRecipients($a_rcp_to), $this->__getEmailRecipients($a_rcp_cc), $this->__getEmailRecipients($a_rcp_bc), $a_m_subject, $a_m_message, $a_attachment); } if (in_array('system',$a_type)) { if (!$this->distributeMail($a_rcp_to,$a_rcp_cc,$a_rcp_bc,$a_m_subject,$a_m_message,$a_attachment,$sent_id,$a_type,'system')) { return $lng->txt("mail_send_error"); } } // ACTIONS FOR TYPE SYSTEM AND NORMAL if (in_array('normal',$a_type)) { // TRY BOTH internal and email (depends on user settings) if (!$this->distributeMail($a_rcp_to,$a_rcp_cc,$a_rcp_bc,$a_m_subject,$a_m_message,$a_attachment,$sent_id,$a_type,'normal')) { return $lng->txt("mail_send_error"); } } // Temporary bugfix if (!$this->getSaveInSentbox()) { $this->deleteMails(array($sent_id)); } return ''; }
ilMail::sendMimeMail | ( | $ | a_rcp_to, | |
$ | a_rcp_cc, | |||
$ | a_rcp_bcc, | |||
$ | a_m_subject, | |||
$ | a_m_message, | |||
$ | a_attachments | |||
) |
send mime mail using class.ilMimeMail.php All external mails are send to SOAP::sendMail starting a kind of background process
string | of recipients | |
string | of recipients | |
string | of recipients | |
string | subject | |
string | message | |
array | attachments public |
Definition at line 1098 of file class.ilMail.php.
References addFullname(), getEmailOfSender(), and isSOAPEnabled().
Referenced by distributeMail(), and sendMail().
{ #var_dump("<pre>",$a_rcp_to,$a_rcp_cc,$a_rcp_bcc,$a_m_subject,$a_m_message,$a_attachments,"<pre>"); $inst_name = $this->ilias->getSetting("inst_name") ? $this->ilias->getSetting("inst_name") : "ILIAS 3"; $a_m_subject = "[".$inst_name."] ".$a_m_subject; if($this->isSOAPEnabled()) { // Send per soap include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php'; $soap_client = new ilSoapClient(); $soap_client->setTimeout(1); $soap_client->setResponseTimeout(1); $soap_client->enableWSDL(true); $soap_client->init(); $attachments = array(); foreach($a_attachments as $attachment) { $attachments[] = $this->mfile->getAbsolutePath($attachment); } $attachments = implode(',',$attachments); $soap_client->call('sendMail',array($_COOKIE['PHPSESSID'].'::'.$_COOKIE['ilClientId'], // session id $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $this->addFullname($this->getEmailOfSender()), $a_m_subject, $a_m_message, $attachments)); return true; } else { // send direct include_once "classes/class.ilMimeMail.php"; $sender = $this->addFullname($this->getEmailOfSender()); $mmail = new ilMimeMail(); $mmail->autoCheck(false); $mmail->From($sender); $mmail->To($a_rcp_to); // Add installation name to subject $mmail->Subject($a_m_subject); $mmail->Body($a_m_message); if ($a_rcp_cc) { $mmail->Cc($a_rcp_cc); } if ($a_rcp_bcc) { $mmail->Bcc($a_rcp_bcc); } foreach ($a_attachments as $attachment) { $mmail->Attach($this->mfile->getAbsolutePath($attachment)); } $mmail->Send(); } }
ilMail::setMailMessage | ( | $ | a_message | ) |
Definition at line 250 of file class.ilMail.php.
{ $this->mail_message = $a_message; }
ilMail::setMailRcpBc | ( | $ | a_rcp_bc | ) |
Definition at line 230 of file class.ilMail.php.
{ $this->mail_rcp_bc = $a_rcp_bc; }
ilMail::setMailRcpCc | ( | $ | a_rcp_cc | ) |
Definition at line 220 of file class.ilMail.php.
{ $this->mail_rcp_cc = $a_rcp_cc; }
ilMail::setMailRcpTo | ( | $ | a_rcp_to | ) |
Definition at line 210 of file class.ilMail.php.
{ $this->mail_rcp_to = $a_rcp_to; }
ilMail::setMailSendType | ( | $ | a_types | ) |
Definition at line 200 of file class.ilMail.php.
{ $this->mail_send_type = $a_types; }
ilMail::setMailSubject | ( | $ | a_subject | ) |
Definition at line 240 of file class.ilMail.php.
{ $this->mail_subject = $a_subject; }
ilMail::setSaveInSentbox | ( | $ | a_save_in_sentbox | ) |
Definition at line 185 of file class.ilMail.php.
Referenced by ilMail().
{ $this->save_in_sentbox = $a_save_in_sentbox; }
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 | |||
) |
Definition at line 478 of file class.ilMail.php.
{ $query = "UPDATE $this->table_mail ". "SET folder_id = '".$a_folder_id."',". "attachments = '".addslashes(serialize($a_attachments))."',". "send_time = now(),". "rcp_to = '".addslashes($a_rcp_to)."',". "rcp_cc = '".addslashes($a_rcp_cc)."',". "rcp_bcc = '".addslashes($a_rcp_bcc)."',". "m_status = 'read',". "m_type = '".addslashes(serialize($a_m_type))."',". "m_email = '".$a_m_email."',". "m_subject = '".addslashes($a_m_subject)."',". "m_message = '".addslashes($a_m_message)."' ". "WHERE mail_id = '".$a_draft_id."'"; $res = $this->ilias->db->query($query); return $a_draft_id; }
ilMail::$ilias |
Definition at line 43 of file class.ilMail.php.
Referenced by ilMail().
ilMail::$lng |
Definition at line 50 of file class.ilMail.php.
Referenced by ilMail(), and sendMail().
ilMail::$mail_counter |
Definition at line 87 of file class.ilMail.php.
ilMail::$mail_data |
Definition at line 94 of file class.ilMail.php.
ilMail::$mail_message |
Definition at line 127 of file class.ilMail.php.
ilMail::$mail_obj_ref_id |
Definition at line 102 of file class.ilMail.php.
ilMail::$mail_options |
Definition at line 59 of file class.ilMail.php.
ilMail::$mail_rcp_bc |
Definition at line 125 of file class.ilMail.php.
ilMail::$mail_rcp_cc |
Definition at line 124 of file class.ilMail.php.
ilMail::$mail_rcp_to |
Definition at line 123 of file class.ilMail.php.
ilMail::$mail_send_type |
Definition at line 109 of file class.ilMail.php.
ilMail::$mail_subject |
Definition at line 126 of file class.ilMail.php.
ilMail::$mfile |
Definition at line 57 of file class.ilMail.php.
ilMail::$save_in_sentbox |
Definition at line 116 of file class.ilMail.php.
ilMail::$soap_enabled = true |
Definition at line 129 of file class.ilMail.php.
ilMail::$table_mail |
Definition at line 73 of file class.ilMail.php.
ilMail::$table_mail_saved |
Definition at line 80 of file class.ilMail.php.
ilMail::$user_id |
Definition at line 66 of file class.ilMail.php.
Referenced by checkRecipients().