bugfix + refactoring

This commit is contained in:
Jonathan Labreuille
2016-03-01 16:23:15 +01:00
parent 82ed7e51c5
commit 12c159c627
7 changed files with 281 additions and 232 deletions

View File

@ -115,6 +115,7 @@ class Subscriber extends Model {
$segment_names = array_map(function($segment) {
return $segment->name;
}, $segments);
$body = nl2br($signup_confirmation['body']);
// replace list of segments shortcode
@ -152,14 +153,14 @@ class Subscriber extends Model {
// set from
$from = (
!empty($signup_confirmation['from'])
&& !empty($signup_confirmation['email'])
&& !empty($signup_confirmation['from']['email'])
) ? $signup_confirmation['from']
: false;
// set reply to
$reply_to = (
!empty($signup_confirmation['reply_to'])
&& !empty($signup_confirmation['reply_to'])
&& !empty($signup_confirmation['reply_to']['email'])
) ? $signup_confirmation['reply_to']
: false;
@ -168,6 +169,7 @@ class Subscriber extends Model {
$mailer = new Mailer(false, $from, $reply_to);
return $mailer->send($email, $subscriber);
} catch(\Exception $e) {
$this->setError($e->getMessage());
return false;
}
}