Inheritance diagram for ilMail:Public Member Functions | |
| ilMail ($a_user_id) | |
| Constructor setup an mail object public. | |
| 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 | |
| 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 | |
Definition at line 35 of file class.ilMail.php.
| ilMail::__checkSystemRecipients | ( | &$ | a_rcp_to | ) |
Definition at line 1240 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;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMail::__getCountRecipient | ( | $ | rcp, | |
| $ | a_only_email = true | |||
| ) |
Definition at line 1180 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;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMail::__getCountRecipients | ( | $ | a_to, | |
| $ | a_cc, | |||
| $ | a_bcc, | |||
| $ | a_only_email = true | |||
| ) |
Definition at line 1203 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);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMail::__getEmailRecipients | ( | $ | a_rcp | ) |
Definition at line 1210 of file class.ilMail.php.
References explodeRecipients().
Referenced by sendMail().
{
foreach ($this->explodeRecipients($a_rcp) as $to)
{
if (strpos($to,'@'))
{
$rcp[] = $to;
}
}
return $rcp ? $rcp : array();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMail::__prependMessage | ( | $ | a_m_message, | |
| $ | rcp_to, | |||
| $ | rcp_cc | |||
| ) |
Definition at line 1223 of file class.ilMail.php.
Referenced by sendMail().
{
$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;
}
Here is the caller graph for this function:| ilMail::__substituteRecipients | ( | $ | a_rcp, | |
| $ | direction | |||
| ) |
Definition at line 1252 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);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMail::addFullname | ( | $ | a_email | ) |
add user fullname to mail 'From'
| string | email of sender |
Definition at line 1052 of file class.ilMail.php.
References $ilUser, and ilMimeMail::_mimeEncode().
Referenced by sendMimeMail().
{
include_once 'classes/class.ilMimeMail.php';
global $ilUser;
return ilMimeMail::_mimeEncode($ilUser->getFullname()).'<'.$a_email.'>';
}
Here is the call graph for this function:
Here is the caller graph for this function:| 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 670 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;
}
Here is the caller graph for this function:| 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 751 of file class.ilMail.php.
References $rbacsystem, $user_id, explodeRecipients(), ilObjUser::getUserIdByLogin(), ilUtil::groupNameExists(), and ilUtil::is_email().
Referenced by sendMail().
{
global $rbacsystem;
$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;
}
}
}
else
{
if (!ilUtil::groupNameExists(addslashes(substr($rcp,1))))
{
$wrong_rcps .= "<BR/>".$rcp;
continue;
}
}
}
return $wrong_rcps;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMail::deleteMails | ( | $ | a_mail_ids | ) |
delete mail public
| array | mail ids |
Definition at line 414 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;
}
Here is the caller graph for this function:| 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 552 of file class.ilMail.php.
References $id, $mbox, $tmp_user, __substituteRecipients(), 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'
foreach ($as_email as $id)
{
$tmp_user =& new ilObjUser($id);
$this->sendMimeMail('','',$tmp_user->getEmail(),$a_subject,$a_message,$a_attachments);
}
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMail::explodeRecipients | ( | $ | a_recipients | ) |
explode recipient string allowed seperators are ',' ';' ' ' private
Definition at line 1159 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);
$rcps = explode(',',$a_recipients);
if (count($rcps))
{
for ($i = 0; $i < count($rcps); ++ $i)
{
$rcps[$i] = trim($rcps[$i]);
}
}
return is_array($rcps) ? $rcps : array();
}
Here is the caller graph for this function:| ilMail::fetchMailData | ( | $ | a_row | ) |
fetch all query data from table mail public
| object | object of query |
Definition at line 435 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));
}
Here is the caller graph for this function:| ilMail::getAttachments | ( | ) |
get attachments public
Definition at line 1148 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 1111 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 '';
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| 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 695 of file class.ilMail.php.
References $grp_data, $id, $tmp_user, explodeRecipients(), ilObjectFactory::getInstanceByRefId(), ilObjUser::getUserIdByLogin(), and ilUtil::searchGroups().
{
$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");
// GET GROUP MEMBER IDS
$grp_data = ilUtil::searchGroups(substr($rcp,1));
// INSTATIATE GROUP OBJECT
foreach ($grp_data as $grp)
{
$grp_object = ilObjectFactory::getInstanceByRefId($grp["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;
}
Here is the call graph for this function:| ilMail::getMail | ( | $ | a_mail_id | ) |
get data of one mail public
| int | mail_id |
Definition at line 333 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;
}
Here is the call graph for this function:| ilMail::getMailCounterData | ( | ) |
get mail counter data returns data array with indexes "total","read","unread" public
Definition at line 319 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 264 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 275 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();
}
Here is the call graph for this function:| ilMail::getSavedData | ( | ) |
get saved data public
Definition at line 848 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;
}
Here is the call graph for this function:| ilMail::getSaveInSentbox | ( | ) |
Definition at line 167 of file class.ilMail.php.
Referenced by sendMail().
{
return $this->save_in_sentbox;
}
Here is the caller graph for this function:| ilMail::getUserIds | ( | $ | a_recipients | ) |
get user_ids
| string | recipients seperated by ',' |
Definition at line 620 of file class.ilMail.php.
References $grp_data, $id, explodeRecipients(), ilObjectFactory::getInstanceByRefId(), ilObjUser::getUserIdByLogin(), and ilUtil::searchGroups().
Referenced by distributeMail().
{
$tmp_names = $this->explodeRecipients($a_recipients);
for ($i = 0;$i < count($tmp_names); $i++)
{
if (substr($tmp_names[$i],0,1) == '#')
{
include_once("./classes/class.ilObjectFactory.php");
// GET GROUP MEMBER IDS
$grp_data = ilUtil::searchGroups(substr($tmp_names[$i],1));
// INSTATIATE GROUP OBJECT
foreach ($grp_data as $grp)
{
$grp_object = ilObjectFactory::getInstanceByRefId($grp["ref_id"]);
break;
}
// STORE MEMBER IDS IN $ids
foreach ($grp_object->getGroupMemberIds() as $id)
{
$ids[] = $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 is_array($ids) ? $ids : array();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMail::ilMail | ( | $ | a_user_id | ) |
Constructor setup an mail object public.
| integer | user_id |
Definition at line 136 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();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMail::markRead | ( | $ | a_mail_ids | ) |
mark mails as read public
| array | mail ids |
Definition at line 350 of file class.ilMail.php.
| ilMail::markUnread | ( | $ | a_mail_ids | ) |
mark mails as unread public
| array | mail ids |
Definition at line 371 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 393 of file class.ilMail.php.
| ilMail::readMailObjectReferenceId | ( | ) |
read and set mail object id private
Definition at line 236 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;
}
}
Here is the caller graph for this function:| ilMail::saveAttachments | ( | $ | a_attachments | ) |
set attachments
| array | array of attachments public |
Definition at line 1132 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 1033 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);
}
Here is the call graph for this function:
Here is the caller graph for this function:| 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 813 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 503 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 FROM $this->table_mail";
$row = $this->ilias->db->getRow($query,DB_FETCHMODE_ASSOC);
return $row["id"];
}
Here is the caller graph for this function:| 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 871 of file class.ilMail.php.
References $lng, $rbacsystem, __checkSystemRecipients(), __getCountRecipients(), __getEmailRecipients(), __prependMessage(), __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");
}
//IF ONLY EMAIL
if ( $c_rcp == $c_emails)
{
// SEND IT
$this->sendMimeMail($a_rcp_to,
$a_rcp_cc,
$a_rcp_bc,
$a_m_subject,$a_m_message,$a_attachment);
}
else
{
// SET ALL EMAIL RECIPIENTS BCC AND CREATE A LINE ('to','cc') in Message body
$new_bcc = array_merge($this->__getEmailRecipients($a_rcp_to),
$this->__getEmailRecipients($a_rcp_cc),
$this->__getEmailRecipients($a_rcp_bcc));
$this->sendMimeMail("",
"",
$new_bcc,
$a_m_subject,
$this->__prependMessage($a_m_message,$a_rcp_to,$a_rcp_cc),
$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 '';
}
Here is the call graph for this function:| 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
| string | to or array of recipients | |
| string | cc array of recipients | |
| string | bcc array of recipients | |
| string | subject | |
| string | message | |
| array | attachments public |
Definition at line 1072 of file class.ilMail.php.
References addFullname(), and getEmailOfSender().
Referenced by distributeMail(), and sendMail().
{
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
$inst_name = $this->ilias->getSetting("inst_name") ? $this->ilias->getSetting("inst_name") : "ILIAS 3";
$a_m_subject = "[".$inst_name."] ".$a_m_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();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMail::setMailMessage | ( | $ | a_message | ) |
Definition at line 227 of file class.ilMail.php.
{
$this->mail_message = $a_message;
}
| ilMail::setMailRcpBc | ( | $ | a_rcp_bc | ) |
Definition at line 207 of file class.ilMail.php.
{
$this->mail_rcp_bc = $a_rcp_bc;
}
| ilMail::setMailRcpCc | ( | $ | a_rcp_cc | ) |
Definition at line 197 of file class.ilMail.php.
{
$this->mail_rcp_cc = $a_rcp_cc;
}
| ilMail::setMailRcpTo | ( | $ | a_rcp_to | ) |
Definition at line 187 of file class.ilMail.php.
{
$this->mail_rcp_to = $a_rcp_to;
}
| ilMail::setMailSendType | ( | $ | a_types | ) |
Definition at line 177 of file class.ilMail.php.
{
$this->mail_send_type = $a_types;
}
| ilMail::setMailSubject | ( | $ | a_subject | ) |
Definition at line 217 of file class.ilMail.php.
{
$this->mail_subject = $a_subject;
}
| ilMail::setSaveInSentbox | ( | $ | a_save_in_sentbox | ) |
Definition at line 162 of file class.ilMail.php.
Referenced by ilMail().
{
$this->save_in_sentbox = $a_save_in_sentbox;
}
Here is the caller graph for this function:| 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 455 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::$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().
1.7.1