Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Send HTML content in email #1589

Merged
merged 5 commits into from
Oct 3, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/pds/src/mailer/moderation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Transporter } from 'nodemailer'
import Mail from 'nodemailer/lib/mailer'
import { htmlToText } from 'nodemailer-html-to-text'
import SMTPTransport from 'nodemailer/lib/smtp-transport'
import { ServerConfig } from '../config'
import { mailerLogger } from '../logger'
Expand All @@ -14,14 +15,17 @@ export class ModerationMailer {
) {
this.config = config
this.transporter = transporter
this.transporter.use('compile', htmlToText())
}

async send({ content }: { content: string }, mailOpts: Mail.Options) {
const res = await this.transporter.sendMail({
const mail = {
...mailOpts,
text: content,
html: content,
from: this.config.moderationEmailAddress,
})
}

const res = await this.transporter.sendMail(mail)

if (!this.config.moderationEmailSmtpUrl) {
mailerLogger.debug(
Expand Down
Loading