@@ -337,19 +337,21 @@ public function addUser(string $userid,
337337			}
338338
339339			// Send new user mail only if a mail is set 
340- 			if  ($ email''  &&  $ this -> config -> getAppValue ( ' core ' ,  ' newUser.sendEmail ' ,  ' yes ' ) ===  ' yes ' 
340+ 			if  ($ email'' ) {
341341				$ newUsersetEMailAddress ($ email
342- 				try  {
343- 					$ emailTemplate$ this newUserMailHelper ->generateTemplate ($ newUser$ generatePasswordResetToken
344- 					$ this newUserMailHelper ->sendMail ($ newUser$ emailTemplate
345- 				} catch  (\Exception   $ e
346- 					// Mail could be failing hard or just be plain not configured 
347- 					// Logging error as it is the hardest of the two 
348- 					$ this logger ->logException ($ e
349- 						'message '  => "Unable to send the invitation mail to  $ email ,
350- 						'level '  => ILogger::ERROR ,
351- 						'app '  => 'ocs_api ' ,
352- 					]);
342+ 				if  ($ this config ->getAppValue ('core ' , 'newUser.sendEmail ' , 'yes ' ) === 'yes ' ) {
343+ 					try  {
344+ 						$ emailTemplate$ this newUserMailHelper ->generateTemplate ($ newUser$ generatePasswordResetToken
345+ 						$ this newUserMailHelper ->sendMail ($ newUser$ emailTemplate
346+ 					} catch  (\Exception   $ e
347+ 						// Mail could be failing hard or just be plain not configured 
348+ 						// Logging error as it is the hardest of the two 
349+ 						$ this logger ->logException ($ e
350+ 							'message '  => "Unable to send the invitation mail to  $ email ,
351+ 							'level '  => ILogger::ERROR ,
352+ 							'app '  => 'ocs_api ' ,
353+ 						]);
354+ 					}
353355				}
354356			}
355357
0 commit comments