Index: branches/5.2.x/core/kernel/utility/email_send.php =================================================================== diff -u -N -r14699 -r14861 --- branches/5.2.x/core/kernel/utility/email_send.php (.../email_send.php) (revision 14699) +++ branches/5.2.x/core/kernel/utility/email_send.php (.../email_send.php) (revision 14861) @@ -1,6 +1,6 @@ headers = Array (); $this->bodyPartNumber = false; - $this->parts = Array(); + $this->parts = Array (); $this->guessOptions = Array ( - 'attachments' => Array(), + 'attachments' => Array (), 'inline_attachments' => Array (), 'text_part' => false, 'html_part' => false, ); $this->SetCharset(null, true); + $this->_logData = Array (); } /** @@ -1984,14 +1992,20 @@ $composed = $this->GetHeadersAndBody($message_headers, $message_body); } - if ($composed) { - if ($immediate_send === true) { - $send_method = 'Send'.$this->sendMethod; + if ( $composed ) { + if ( $immediate_send === true ) { + $send_method = 'Send' . $this->sendMethod; $result = $this->$send_method($message_headers, $message_body); - if ($immediate_clear) { + if ( $result && $this->_logData ) { + // add e-mail log record + $this->Conn->doInsert($this->_logData, TABLE_PREFIX . 'EmailLog'); + } + + if ( $immediate_clear ) { $this->Clear(); } + return $result; } else { @@ -2002,12 +2016,14 @@ 'SendRetries' => 0, 'LastSendRetry' => 0, 'MailingId' => (int)$immediate_send, + 'LogData' => serialize($this->_logData), // remember e-mail log record ); + $fields_hash['MessageHeaders'] = serialize($message_headers); $fields_hash['MessageBody'] =& $message_body; - $this->Conn->doInsert($fields_hash, TABLE_PREFIX.'EmailQueue'); + $this->Conn->doInsert($fields_hash, TABLE_PREFIX . 'EmailQueue'); - if ($immediate_clear) { + if ( $immediate_clear ) { $this->Clear(); } } @@ -2017,4 +2033,15 @@ return $immediate_send !== true ? true : false; } + /** + * Sets log data + * + * @param string $log_data + * @return void + * @access public + */ + public function setLogData($log_data) + { + $this->_logData = $log_data; + } } \ No newline at end of file