Skip to content

Commit

Permalink
Merge branch 'release/2.6.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Sep 7, 2017
2 parents e406231 + 941c538 commit 75c588d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v2.6.1
## 09/07/2017

1. [](#improved)
* Improved the error message when missing `from` in the configuration
* Silently catch malformed email exceptions

# v2.6.0
## 05/22/2017

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Email
version: 2.6.0
version: 2.6.1
description: Enables the emailing system for Grav
icon: envelope
author:
Expand Down
2 changes: 1 addition & 1 deletion classes/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static function sendEmail($subject, $content, $to, $from = null, $mimetyp
}

if (!isset($grav['Email']) || empty($from)) {
throw new \RuntimeException($grav['language']->translate('PLUGIN_EMAIL.EMAIL_NOT_CONFIGURED'));
throw new \RuntimeException($grav['language']->translate('PLUGIN_EMAIL.PLEASE_CONFIGURE_A_FROM_ADDRESS'));
}

if (empty($to) || empty($subject) || empty($content)) {
Expand Down
31 changes: 26 additions & 5 deletions email.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Grav\Common\Twig\Twig;
use Grav\Plugin\Email\Email;
use RocketTheme\Toolbox\Event\Event;
use Swift_RfcComplianceException;

class EmailPlugin extends Plugin
{
Expand Down Expand Up @@ -141,7 +142,11 @@ protected function buildMessage(array $params, array $vars = array())
switch ($key) {
case 'bcc':
foreach ($this->parseAddressValue($value, $vars) as $address) {
$message->addBcc($address->mail, $address->name);
try {
$message->addBcc($address->mail, $address->name);
} catch (Swift_RfcComplianceException $e) {
continue;
}
}
break;

Expand Down Expand Up @@ -195,7 +200,11 @@ protected function buildMessage(array $params, array $vars = array())
}

foreach ($this->parseAddressValue($value, $vars) as $address) {
$message->addCc($address->mail, $address->name);
try {
$message->addCc($address->mail, $address->name);
} catch (Swift_RfcComplianceException $e) {
continue;
}
}
break;

Expand All @@ -208,7 +217,11 @@ protected function buildMessage(array $params, array $vars = array())
}

foreach ($this->parseAddressValue($value, $vars) as $address) {
$message->addFrom($address->mail, $address->name);
try {
$message->addFrom($address->mail, $address->name);
} catch (Swift_RfcComplianceException $e) {
continue;
}
}
break;

Expand All @@ -221,7 +234,11 @@ protected function buildMessage(array $params, array $vars = array())
}

foreach ($this->parseAddressValue($value, $vars) as $address) {
$message->addReplyTo($address->mail, $address->name);
try {
$message->addReplyTo($address->mail, $address->name);
} catch (Swift_RfcComplianceException $e) {
continue;
}
}
break;

Expand All @@ -238,7 +255,11 @@ protected function buildMessage(array $params, array $vars = array())
}

foreach ($this->parseAddressValue($value, $vars) as $address) {
$message->addTo($address->mail, $address->name);
try {
$message->addTo($address->mail, $address->name);
} catch (Swift_RfcComplianceException $e) {
continue;
}
}
break;
}
Expand Down

0 comments on commit 75c588d

Please sign in to comment.