public function send($recs, $title, $contents, $from = array()) { if ($this->user_smtp) { $mail = new Mail_SMTP(); $mail->send($recs, $title, $contents); } else { $this->_send($recs, $title, $contents); } }
/** * Filters any messages sent through the Utils::mail() function, attempting to send them via SMTP instead. * * @param boolean Whether this message has already been handled by another plugin or not. * @param array The content of the message to send. * @return boolean Whether or not this plugin handled the message. **/ function filter_send_mail($handled, $mail) { require dirname(__FILE__) . '/mail.php'; // Start SMTP object $smtp = new Mail_SMTP(array('host' => (Options::get('mailsmtp__ssl') ? 'ssl://' : '') . Options::get('mailsmtp__hostname'), 'port' => (int) Options::get('mailsmtp__port'), 'auth' => (bool) Options::get('mailsmtp__auth'), 'username' => Options::get('mailsmtp__username'), 'password' => Options::get('mailsmtp__password'))); // Make header array $headers = array_merge($mail['headers'], array('To' => $mail['to'], 'Subject' => $mail['subject'], 'From' => Options::get('mailsmtp__from'))); // Send! $result = $smtp->send($mail['to'], $headers, $mail['message']); if ($result === true) { $handled = true; return true; } else { // log the reason why EventLog::log(_t('Unable to send SMTP message: %s', array($result->get()))); $handled = false; return false; } }