diff --git a/laravel_app/app/Mail/ReportMailer.php b/laravel_app/app/Mail/ReportMailer.php index 8ec28b0..12fb061 100644 --- a/laravel_app/app/Mail/ReportMailer.php +++ b/laravel_app/app/Mail/ReportMailer.php @@ -26,7 +26,8 @@ class ReportMailer extends Mailable public function __construct(ProjectMailing $mailing) { $this->mailing = $mailing; - $this->to($mailing->recipients()->pluck('email')->toArray()); +// logger($mailing->recipients()->pluck('email')->toArray()); +// $this->to(['martin@sobit.nl', ...($mailing->recipients()->pluck('email')->toArray())]); } /** diff --git a/laravel_app/app/Models/ProjectMailing.php b/laravel_app/app/Models/ProjectMailing.php index 43e5744..03ce30a 100644 --- a/laravel_app/app/Models/ProjectMailing.php +++ b/laravel_app/app/Models/ProjectMailing.php @@ -21,7 +21,11 @@ class ProjectMailing extends Model protected static function booted() { static::created(function (ProjectMailing $projectMailing) { - Mail::to($projectMailing->recipients()->pluck('email')->toArray()) + $toAddresses = $projectMailing->recipients()->pluck('email')->toArray(); + logger('created'); + logger($projectMailing); + + Mail::to($toAddresses) ->send(new \App\Mail\ReportMailer($projectMailing)); }); }