CMS  Version 3.9
email_log.inc
Go to the documentation of this file.
1 <?php
8 class EmailLog extends DataItem
9 {
10  var $table = "email_log";
11  var $primary_key = "email_log_id";
12 
13  var $fields = array(
14  "email_log_id" => Number,
15  "sender_name" => String,
16  "sender_email" => String,
17  "recipient_name" => String,
18  "recipient_email" => String,
19  "subject" => String,
20  "message" => HTML,
21  "date_sent" => Timestamp,
22  );
23 
31  static function logEmail($mgr, $toAddr, $rtn)
32  {
33  // don't save log if email not sent.
34  if(!$rtn) return;
35 
36  if (Settings::getValue("email", "log_messages"))
37  {
38  $item = $mgr->item;
39 
40  $log = new EmailLog();
41  $log->recipient_name = "";
42  $log->recipient_email = $toAddr;
43  $log->sender_email = $mgr->emailFrom;
44  $log->sender_name = $mgr->emailName;
45  $log->subject = $mgr->subject;
46  $log->message = Settings::getValue("email", "log_message_bodies") ? $mgr->message : "";
47  $log->save();
48  }
49  }
50 }?>
static logEmail($mgr, $toAddr, $rtn)
Record email sent in a log.
Definition: email_log.inc:31
static getValue($component, $name)
Retrieve the value of the specified Setting.
Definition: settings.inc:104