/** * Send email reports of unresolved transactions * (that need to be resolved manually via AdminInterface). * * @param array $report Transactions to be reported. * * @return void */ protected function sendReports($report) { $renderer = $this->viewManager->getRenderer(); $subject = 'Finna: ilmoitus tietokannan %s epäonnistuneista verkkomaksuista'; foreach ($report as $driver => $cnt) { if ($cnt) { $settings = $this->configReader->get("VoyagerRestful_{$driver}"); if (!$settings || !isset($settings['OnlinePayment']['errorEmail'])) { $this->err(" No error email for expired transactions not defined for " . "driver {$driver} ({$cnt} expired transactions)"); continue; } $email = $settings['OnlinePayment']['errorEmail']; $this->msg(" [{$driver}] Inform {$cnt} expired transactions " . "for driver {$driver} to {$email}"); $params = ['driver' => $driver, 'cnt' => $cnt]; $messageSubject = sprintf($subject, $driver); $message = $renderer->render('Email/online-payment-alert.phtml', $params); try { $this->mailer->send($email, $this->fromEmail, $messageSubject, $message); } catch (\Exception $e) { $this->err(" Failed to send error email to customer: {$email} " . "(driver: {$driver})"); continue; } } } }
/** * Constructor * * Sets up SMS carriers and other settings from sms.ini. * * @param \Zend\Mail\Transport\TransportInterface $transport Mail transport * object (we'll build our own if none is provided). * @param \Zend\Config\Config $config VuFind configuration * object (we'll auto-load if none is provided). */ public function __construct($transport = null, $config = null) { // Set up parent object first: parent::__construct($transport, $config); // if using sms.ini, then load the carriers from it // otherwise, fall back to the default list of US carriers $smsConfig = ConfigReader::getConfig('sms'); if (isset($smsConfig->Carriers) && count($smsConfig->Carriers) > 0) { $this->carriers = array(); foreach ($smsConfig->Carriers as $id => $settings) { list($domain, $name) = explode(':', $settings, 2); $this->carriers[$id] = array('name' => $name, 'domain' => $domain); } } // Load default "from" address: $this->defaultFrom = isset($this->config->Site->email) ? $this->config->Site->email : ''; }