feat: add debug logging for SMTP configuration and detailed mail delivery status
Build and Push Multi-Platform Images / build-and-push (push) Failing after 34s
Build and Push Multi-Platform Images / build-and-push (push) Failing after 34s
This commit is contained in:
@@ -25,10 +25,27 @@ export class MailService {
|
||||
body: string;
|
||||
html?: string;
|
||||
attachments?: { filename: string; content: Buffer }[];
|
||||
smtpOverride?: { host: string; port: number; secure: boolean; user: string; pass: string; from: string };
|
||||
}): Promise<void> {
|
||||
const from = this.configService.get<string>('SMTP_FROM', 'paperless@localhost');
|
||||
let transporter = this.transporter;
|
||||
let from = this.configService.get<string>('SMTP_FROM', 'paperless@localhost');
|
||||
|
||||
await this.transporter.sendMail({
|
||||
if (options.smtpOverride) {
|
||||
const o = options.smtpOverride;
|
||||
transporter = nodemailer.createTransport({
|
||||
host: o.host,
|
||||
port: o.port,
|
||||
secure: o.secure,
|
||||
auth: { user: o.user, pass: o.pass },
|
||||
});
|
||||
from = o.from || from;
|
||||
} else {
|
||||
this.logger.debug(
|
||||
`SMTP config — host: ${this.configService.get('SMTP_HOST')} port: ${this.configService.get('SMTP_PORT')} secure: ${this.configService.get('SMTP_SECURE')} user: ${this.configService.get('SMTP_USER')} from: ${from}`,
|
||||
);
|
||||
}
|
||||
|
||||
const info = await transporter.sendMail({
|
||||
from,
|
||||
to: options.to,
|
||||
subject: options.subject,
|
||||
@@ -40,6 +57,8 @@ export class MailService {
|
||||
})),
|
||||
});
|
||||
|
||||
this.logger.log(`Mail gesendet an ${options.to}: "${options.subject}"`);
|
||||
this.logger.log(
|
||||
`Mail gesendet an ${options.to}: "${options.subject}" — messageId: ${info.messageId} accepted: ${JSON.stringify(info.accepted)} rejected: ${JSON.stringify(info.rejected)} response: ${info.response}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user