Skip to content

Commit

Permalink
added subject to some email templates
Browse files Browse the repository at this point in the history
  • Loading branch information
valentin-stamate committed May 23, 2022
1 parent d0b7ef2 commit 86e6f5b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/service/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export class AdminService {

try {
await MailService.sendMail({
from: from,
subject: subject,
from: from,
to: data.emailTo,
html: emailContent,
});
Expand Down Expand Up @@ -286,8 +286,8 @@ export class AdminService {

try {
await MailService.sendMail({
from: from,
subject: `${subject} nr. ${data.report[1]} - drd. ${data.studentName}`,
from: from,
to: data.studentEmail,
html: emailContent,
attachments: [{
Expand Down
3 changes: 3 additions & 0 deletions src/app/service/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export class AuthService {

try {
await MailService.sendMail({
subject: SignupMessage.subject,
from: EmailDefaults.FROM,
to: email,
html: SignupMessage.getHtml(email),
Expand Down Expand Up @@ -137,6 +138,7 @@ export class AuthService {

try {
await MailService.sendMail({
subject: LoginMessage.subject,
from: EmailDefaults.FROM,
to: loginEmail,
html: LoginMessage.getHtml(generatedCode),
Expand Down Expand Up @@ -225,6 +227,7 @@ export class AuthService {

try {
await MailService.sendMail({
subject: AdminLoginMessage.subject,
from: EmailDefaults.FROM,
to: email,
html: AdminLoginMessage.getHtml(generatedCode),
Expand Down
8 changes: 7 additions & 1 deletion src/app/services/email.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,30 @@ export class MailService {
}

export class LoginMessage {
static subject = '[Login] Școala Doctorală FII';

static getHtml(code: string) {
return `Hello! In order to log in paste this code into the app <b>${code}</b> .`;
}
}

export class SignupMessage {
static subject = '[Signup] Școala Doctorală FII';

static getHtml(firstname: string) {
return `Hello: ${firstname}! Welcome!`;
}
}

export class AdminLoginMessage {
static subject = '[Login] Școala Doctorală FII';

static getHtml(code: string) {
return `Hello! In order to log in paste this code into the app <b>${code}</b> .`;
}
}

export enum EmailDefaults {
FROM = 'Scoala Doctorala FII <adriana.bejinariu@info.uaic.ro>',
FROM = 'Școala Doctorală FII <adriana.bejinariu@info.uaic.ro>',
APP_NAME = 'Școala Doctorală de Informatică',
}

0 comments on commit 86e6f5b

Please sign in to comment.