Skip to content

Commit

Permalink
Ability to register user without exceptions at frontpage
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Jan 21, 2016
1 parent d38f243 commit 64ab2bf
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions app/library/Mail/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
class Mail extends Component
{

protected $transport;

protected $amazonSes;
Expand All @@ -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;
Expand All @@ -55,6 +60,7 @@ private function amazonSESSend($raw)
*
* @param string $name
* @param array $params
* @return string
*/
public function getTemplate($name, $params)
{
Expand All @@ -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;

Expand Down

0 comments on commit 64ab2bf

Please sign in to comment.