Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Fixed mailer

Blaumaus44b9b8d5f267
diff --git a/package.json b/package.json
index 3a2a2a909..8297df88d 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,7 @@
"@nestjs/swagger": "^4.8.0",
"@nestjs/typeorm": "^7.1.5",
"bcrypt": "^5.0.1",
+ "class-transformer": "^0.4.0",
"class-validator": "^0.13.1",
"cookie-parser": "^1.4.5",
"handlebars": "^4.7.7",
diff --git a/src/common/templates/en/.gitkeep b/src/common/templates/en/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/mailer/mailer.service.ts b/src/mailer/mailer.service.ts
index eca11d9bc..e96bc9465 100644
--- a/src/mailer/mailer.service.ts
+++ b/src/mailer/mailer.service.ts
@@ -52,14 +52,14 @@ export class MailerService {
async sendEmail(email: string, templateName: LetterTemplate, params: Params = null): Promise<void> {
try {
- const templatePath = TEMPLATES_PATH +
- '/' + 'EN' +
- '/' + templateName + '_en.html'
+ // const templatePath = TEMPLATES_PATH +
+ // '/' + 'en' +
+ // '/' + templateName + '_en.html'
- const letter = fs.readFileSync(templatePath, { encoding: 'utf-8' })
- const subject = metaInfoJson[templateName]['subject']['EN']
- const template = handlebars.compile(letter)
- const htmlToSend = template(params)
+ // const letter = fs.readFileSync(templatePath, { encoding: 'utf-8' })
+ // const subject = metaInfoJson[templateName]['subject']['EN']
+ // const template = handlebars.compile(letter)
+ // const htmlToSend = template(params)
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
@@ -72,13 +72,15 @@ export class MailerService {
const message = {
from: {
- name: 'Studentenwerk Frankfurt',
+ name: 'Analytics',
address: process.env.FROM_EMAIL
},
to: email,
- subject: subject,
- html: htmlToSend,
+ // subject,
+ // html: htmlToSend,
attachments: [],
+
+ params, // temp var
}
if (process.env.SMTP_MOCK) {
diff --git a/src/main.ts b/src/main.ts
index ca8903e99..574a67261 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -21,6 +21,6 @@ async function bootstrap() {
SwaggerModule.setup('', app, document)
- await app.listen(3005)
+ await app.listen(5005)
}
bootstrap();