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
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion packages/pds/src/api/app/bsky/feed/getPostThread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function (server: Server, ctx: AppContext) {
auth.credentials.type === 'access' ? auth.credentials.did : null

if (!requester) {
const res = await ctx.appviewAgent.api.app.bsky.feed.getPostThread(
const res = await ctx.appViewAgent.api.app.bsky.feed.getPostThread(
params,
authPassthru(req),
)
Expand Down
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.moderationEmail?.fromAddress,
})
}

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

if (!this.config.moderationEmail?.smtpUrl) {
mailerLogger.debug(
Expand Down
Loading