/** * @param null $user to username * @param null $from from email */ function __construct($user = null, $from = null) { require_once 'lib/mail/maillib.php'; $userlib = TikiLib::lib('user'); $to = ''; if (!empty($user)) { if ($userlib->user_exists($user)) { $to = $userlib->get_user_email($user); } else { trigger_error('User not found'); return; } } if (!empty($from)) { $this->mail = tiki_get_basic_mail(); try { $this->mail->setFrom($from); $this->mail->setReturnPath($from); } catch (Exception $e) { // was already set, then do nothing } } else { $this->mail = tiki_get_admin_mail(); } if (!empty($to)) { $this->mail->addTo($to); } }
function tiki_get_admin_mail() { global $prefs; $mail = tiki_get_basic_mail(); $mail->setFrom($prefs['sender_email'], $prefs['browsertitle']); return $mail; }
/** * @return Zend\Mail\Message */ function tiki_get_admin_mail() { global $prefs; $mail = tiki_get_basic_mail(); if (!empty($prefs['sender_email'])) { // [BUG FIX] hollmeer 2012-11-04: // Added returnpath for Sendmail; does not send without; // catch/ignore error, if already set try { $mail->setFrom($prefs['sender_email']); $mail->setSender($prefs['sender_email']); } catch (Exception $e) { // was already set, then do nothing } } return $mail; }