first commit
This commit is contained in:
2
dist/mail/mail.module.d.ts
vendored
Normal file
2
dist/mail/mail.module.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare class MailModule {
|
||||
}
|
||||
23
dist/mail/mail.module.js
vendored
Normal file
23
dist/mail/mail.module.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MailModule = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const mail_service_1 = require("./mail.service");
|
||||
const config_1 = require("@nestjs/config");
|
||||
let MailModule = class MailModule {
|
||||
};
|
||||
exports.MailModule = MailModule;
|
||||
exports.MailModule = MailModule = __decorate([
|
||||
(0, common_1.Module)({
|
||||
imports: [config_1.ConfigModule],
|
||||
providers: [mail_service_1.MailService],
|
||||
exports: [mail_service_1.MailService],
|
||||
})
|
||||
], MailModule);
|
||||
//# sourceMappingURL=mail.module.js.map
|
||||
1
dist/mail/mail.module.js.map
vendored
Normal file
1
dist/mail/mail.module.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mail.module.js","sourceRoot":"","sources":["../../src/mail/mail.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,iDAA6C;AAC7C,2CAA8C;AAOvC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IALtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAY,CAAC;QACvB,SAAS,EAAE,CAAC,0BAAW,CAAC;QACxB,OAAO,EAAE,CAAC,0BAAW,CAAC;KACvB,CAAC;GACW,UAAU,CAAG"}
|
||||
7
dist/mail/mail.service.d.ts
vendored
Normal file
7
dist/mail/mail.service.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
export declare class MailService {
|
||||
private configService;
|
||||
private transporter;
|
||||
constructor(configService: ConfigService);
|
||||
sendTicket(email: string, name: string, ticketId: string, eventName: string, qrCodeBuffer: Buffer): Promise<void>;
|
||||
}
|
||||
96
dist/mail/mail.service.js
vendored
Normal file
96
dist/mail/mail.service.js
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MailService = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const nodemailer = require("nodemailer");
|
||||
const config_1 = require("@nestjs/config");
|
||||
const path = require("path");
|
||||
let MailService = class MailService {
|
||||
constructor(configService) {
|
||||
this.configService = configService;
|
||||
this.transporter = nodemailer.createTransport({
|
||||
host: this.configService.get('SMTP_HOST'),
|
||||
port: this.configService.get('SMTP_PORT'),
|
||||
secure: this.configService.get('SMTP_SECURE') === 'true',
|
||||
auth: {
|
||||
user: this.configService.get('SMTP_USER'),
|
||||
pass: this.configService.get('SMTP_PASS'),
|
||||
},
|
||||
});
|
||||
}
|
||||
async sendTicket(email, name, ticketId, eventName, qrCodeBuffer) {
|
||||
const logoPath = path.join(process.cwd(), 'dist/assets/atiw-out-logo.svg');
|
||||
const firstName = name.split(' ')[0];
|
||||
await this.transporter.sendMail({
|
||||
from: this.configService.get('SMTP_FROM') || '"Event Team" <noreply@example.com>',
|
||||
to: email,
|
||||
subject: `Dein Ticket fürs ATIW OUT!`,
|
||||
html: `
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: #f4f4f5; margin: 0; padding: 0; }
|
||||
.container { max-width: 600px; margin: 32px auto; background-color: #ffffff; border-radius: 8px; overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.2); padding: 32px; }
|
||||
.header { background-color: #ffffff; text-align: center; }
|
||||
.logo { height: 150px;}
|
||||
.content {text-align: center; color: #333333; }
|
||||
.greeting { font-size: 32px; color: #18181b; }
|
||||
.text { font-size: 16px; line-height: 1.5; color: #52525b;}
|
||||
.qr-container { background-color: #f4f4f5; padding: 24px; border-radius: 12px; display: inline-block; margin: 32px 0px; }
|
||||
.footer { background-color: #fafafa; padding: 24px; text-align: center; font-size: 14px; color: #a1a1aa; border-top: 1px solid #e4e4e7; }
|
||||
.highlight { color: #2563eb; font-weight: 600; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<img src="cid:logo" alt="Logo" class="logo" />
|
||||
</div>
|
||||
<div class="content">
|
||||
<h2 class="greeting">Moin Max,</h2>
|
||||
<p class="text">Hier ist dein Ticket für das <strong>ATIW OUT</strong>!</p>
|
||||
<p class="text">Zeig diesen QR Code einfach am <strong>09.12.</strong> am Eingang vor.</p>
|
||||
|
||||
<div class="qr-container">
|
||||
<img src="cid:qrcode" width="200" height="200" alt="Dein Ticket QR Code" style="display: block;"/>
|
||||
</div>
|
||||
|
||||
<p class="text">Wir wünschen dir viel Spaß!</p>
|
||||
<p class="text">~FI231 & FS231</p>
|
||||
<p class="text" style="margin-top: 32px;">Bei Fragen oder Problemen komm bitte<br>zum Klassenraum <strong>E.07</strong> und frag nach <strong>Jason</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
`,
|
||||
attachments: [
|
||||
{
|
||||
filename: 'qrcode.png',
|
||||
content: qrCodeBuffer,
|
||||
cid: 'qrcode',
|
||||
},
|
||||
{
|
||||
filename: 'logo.svg',
|
||||
path: logoPath,
|
||||
cid: 'logo',
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.MailService = MailService;
|
||||
exports.MailService = MailService = __decorate([
|
||||
(0, common_1.Injectable)(),
|
||||
__metadata("design:paramtypes", [config_1.ConfigService])
|
||||
], MailService);
|
||||
//# sourceMappingURL=mail.service.js.map
|
||||
1
dist/mail/mail.service.js.map
vendored
Normal file
1
dist/mail/mail.service.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mail.service.js","sourceRoot":"","sources":["../../src/mail/mail.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yCAAyC;AACzC,2CAA+C;AAC/C,6BAA6B;AAGtB,IAAM,WAAW,GAAjB,MAAM,WAAW;IAGtB,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAC9C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,eAAe,CAAC;YAC5C,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,WAAW,CAAC;YACjD,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,WAAW,CAAC;YACjD,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,aAAa,C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