From 64ab2bf2bef2826c6f65983e70f2cb6becac04b7 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Fri, 22 Jan 2016 00:40:03 +0200 Subject: [PATCH] Ability to register user without exceptions at frontpage --- app/library/Mail/Mail.php | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/app/library/Mail/Mail.php b/app/library/Mail/Mail.php index cf8b708d..0879b47c 100644 --- a/app/library/Mail/Mail.php +++ b/app/library/Mail/Mail.php @@ -12,7 +12,6 @@ */ class Mail extends Component { - protected $transport; protected $amazonSes; @@ -23,28 +22,34 @@ class Mail extends Component * Send a raw e-mail via AmazonSES * * @param string $raw + * @return bool */ private function amazonSESSend($raw) { if ($this->amazonSes == null) { $this->amazonSes = new \AmazonSES( - $this->config->amazon->AWSAccessKeyId, - $this->config->amazon->AWSSecretKey + [ + 'key' => $this->config->amazon->AWSAccessKeyId, + 'secret' => $this->config->amazon->AWSSecretKey + ] ); - $this->amazonSes->disable_ssl_verification(); + @$this->amazonSes->disable_ssl_verification(); } - $response = $this->amazonSes->send_raw_email(array( - 'Data' => base64_encode($raw) - ), array( - 'curlopts' => array( - CURLOPT_SSL_VERIFYHOST => 0, - CURLOPT_SSL_VERIFYPEER => 0 - ) - )); + $response = $this->amazonSes->send_raw_email( + [ + 'Data' => base64_encode($raw) + ], + [ + 'curlopts' => [ + CURLOPT_SSL_VERIFYHOST => 0, + CURLOPT_SSL_VERIFYPEER => 0 + ] + ] + ); if (!$response->isOK()) { - throw new Exception('Error sending email from AWS SES: ' . $response->body->asXML()); + $this->logger->error('Error sending email from AWS SES: ' . $response->body->asXML()); } return true; @@ -55,6 +60,7 @@ private function amazonSESSend($raw) * * @param string $name * @param array $params + * @return string */ public function getTemplate($name, $params) { @@ -76,10 +82,11 @@ public function getTemplate($name, $params) * @param string $subject * @param string $name * @param array $params + * @return bool|int + * @throws Exception */ public function send($to, $subject, $name, $params) { - // Settings $mailSettings = $this->config->mail;