Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea87f26e authored by theronakpatel's avatar theronakpatel
Browse files

changes

parent 6eb4af92
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -129,7 +129,13 @@ class AccountController extends Controller {
	 *
	 **/
	public function sendemail() {
		echo 'test';
		$displayname = 'Ronak';
		$username = 'ronak.patel';
		$userEmail = 'eronax59@gmail.com';
		$language = 'en';
		$this->userService->sendWelcomeEmail($displayname, $username, $userEmail, $language);
		echo 'sent';
		die;
	}
	/**
	 * @NoAdminRequired
+3 −0
Original line number Diff line number Diff line
@@ -172,12 +172,14 @@ class UserService {
		
		$sendgridAPIkey = $this->getSendGridAPIKey();
		if (empty($sendgridAPIkey)) {
			print_r("sendgrid_api_key is missing or empty.");
			$this->logger->warning("sendgrid_api_key is missing or empty.", ['app' => Application::APP_ID]);
			return;
		}
		
		$templateIDs = $this->getSendGridTemplateIDs();
		if (empty($templateIDs)) {
			print_r("welcome_sendgrid_template_ids is missing or empty.");
			$this->logger->warning("welcome_sendgrid_template_ids is missing or empty.", ['app' => Application::APP_ID]);
			return;
		}
@@ -194,6 +196,7 @@ class UserService {
			$email = $this->createSendGridEmail($fromEmail, $fromName, $username, $displayname, $userEmail, $templateID);
			$this->sendEmailWithSendGrid($email, $sendgridAPIkey);
		} catch (Throwable $e) {
			print_r('Error sending welcome email to user: ' . $username . ': ' . $e->getMessage());
			$this->logger->error('Error sending welcome email to user: ' . $username . ': ' . $e->getMessage());
		}
	}