Initial commit with Email Import Wizard and Task Processor updates

This commit is contained in:
2026-05-04 08:02:11 +02:00
commit effdc5d59f
170 changed files with 67739 additions and 0 deletions
@@ -0,0 +1,43 @@
import { Injectable, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import * as nodemailer from 'nodemailer';
@Injectable()
export class MailService {
private readonly logger = new Logger(MailService.name);
private transporter: nodemailer.Transporter;
constructor(private readonly configService: ConfigService) {
this.transporter = nodemailer.createTransport({
host: this.configService.get<string>('SMTP_HOST', ''),
port: this.configService.get<number>('SMTP_PORT', 587),
secure: this.configService.get<string>('SMTP_SECURE', 'false') === 'true',
auth: {
user: this.configService.get<string>('SMTP_USER', ''),
pass: this.configService.get<string>('SMTP_PASS', ''),
},
});
}
async sendMail(options: {
to: string;
subject: string;
body: string;
attachments?: { filename: string; content: Buffer }[];
}): Promise<void> {
const from = this.configService.get<string>('SMTP_FROM', 'paperless@localhost');
await this.transporter.sendMail({
from,
to: options.to,
subject: options.subject,
text: options.body,
attachments: options.attachments?.map(a => ({
filename: a.filename,
content: a.content,
})),
});
this.logger.log(`Mail gesendet an ${options.to}: "${options.subject}"`);
}
}