From a099d1671422901b73ec49c9bbf29ce2befc7623 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 26 Jul 2015 22:08:26 -0700 Subject: [PATCH] Only send email if an email address was given --- app/controllers/admin/UsersController.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/UsersController.php b/app/controllers/admin/UsersController.php index 72ea6be07139..2703d859454c 100755 --- a/app/controllers/admin/UsersController.php +++ b/app/controllers/admin/UsersController.php @@ -771,10 +771,13 @@ public function postImport() $data['first_name'] = $row[0]; $data['password'] = $pass; - Mail::send('emails.send-login', $data, function ($m) use ($newuser) { - $m->to($newuser['email'], $newuser['first_name'] . ' ' . $newuser['last_name']); - $m->subject('Welcome ' . $newuser['first_name']); - }); + if ($newuser['email') { + Mail::send('emails.send-login', $data, function ($m) use ($newuser) { + $m->to($newuser['email'], $newuser['first_name'] . ' ' . $newuser['last_name']); + $m->subject('Welcome ' . $newuser['first_name']); + }); + } + } } }