feat: configure Payload SMTP email adapter
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import type { PayloadEmailAdapter } from "payload";
|
||||
import { getMailFrom, getMailTransport } from "./transport";
|
||||
|
||||
/** Connects Payload's built-in auth emails to the same SMTP transport as ANOUMA's own emails. */
|
||||
export const payloadEmailAdapter: PayloadEmailAdapter = () => ({
|
||||
name: "anouma-smtp",
|
||||
defaultFromAddress: process.env.SMTP_USER || "support@anouma.org",
|
||||
defaultFromName: "ANOUMA",
|
||||
sendEmail: async (message) => {
|
||||
return getMailTransport().sendMail({
|
||||
...message,
|
||||
from: message.from || getMailFrom(),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -30,6 +30,7 @@ import { BookingSettings } from "@/globals/BookingSettings";
|
||||
import { SEOSettings } from "@/globals/SEOSettings";
|
||||
import { CookieSettings } from "@/globals/CookieSettings";
|
||||
import { AnalyticsSettings } from "@/globals/AnalyticsSettings";
|
||||
import { payloadEmailAdapter } from "@/lib/email/payloadAdapter";
|
||||
|
||||
const filename = fileURLToPath(import.meta.url);
|
||||
const dirname = path.dirname(filename);
|
||||
@@ -94,6 +95,7 @@ export default buildConfig({
|
||||
AnalyticsSettings,
|
||||
],
|
||||
editor: lexicalEditor(),
|
||||
email: payloadEmailAdapter,
|
||||
graphQL: {
|
||||
disablePlaygroundInProduction: true,
|
||||
disableIntrospectionInProduction: true,
|
||||
|
||||
Reference in New Issue
Block a user