| @@ 450-462 (lines=13) @@ | ||
| 447 | /** |
|
| 448 | * Send new user mail only if a mail is set |
|
| 449 | */ |
|
| 450 | if ($email !== '') { |
|
| 451 | $user->setEMailAddress($email); |
|
| 452 | try { |
|
| 453 | $emailTemplate = $this->newUserMailHelper->generateTemplate($user, $generatePasswordResetToken); |
|
| 454 | $this->newUserMailHelper->sendMail($user, $emailTemplate); |
|
| 455 | } catch (\Exception $e) { |
|
| 456 | $this->log->logException($e, [ |
|
| 457 | 'message' => "Can't send new user mail to $email", |
|
| 458 | 'level' => \OCP\Util::ERROR, |
|
| 459 | 'app' => 'settings', |
|
| 460 | ]); |
|
| 461 | } |
|
| 462 | } |
|
| 463 | // fetch users groups |
|
| 464 | $userGroups = $this->groupManager->getUserGroupNames($user); |
|
| 465 | ||
| @@ 283-296 (lines=14) @@ | ||
| 280 | } |
|
| 281 | ||
| 282 | // Send new user mail only if a mail is set |
|
| 283 | if ($email !== '') { |
|
| 284 | $newUser->setEMailAddress($email); |
|
| 285 | try { |
|
| 286 | $emailTemplate = $this->newUserMailHelper->generateTemplate($newUser, $generatePasswordResetToken); |
|
| 287 | $this->newUserMailHelper->sendMail($newUser, $emailTemplate); |
|
| 288 | } catch (\Exception $e) { |
|
| 289 | $this->logger->logException($e, [ |
|
| 290 | 'message' => "Can't send new user mail to $email", |
|
| 291 | 'level' => \OCP\Util::ERROR, |
|
| 292 | 'app' => 'ocs_api', |
|
| 293 | ]); |
|
| 294 | throw new OCSException('Unable to send the invitation mail', 109); |
|
| 295 | } |
|
| 296 | } |
|
| 297 | ||
| 298 | return new DataResponse(); |
|
| 299 | ||