feat: send welcome email upon newsletter subscription
This commit is contained in:
parent
dca25ac784
commit
13889cfd2a
@ -1,6 +1,8 @@
|
||||
'use server';
|
||||
|
||||
import { sendEmail } from '@/mail';
|
||||
import { subscribe } from '@/newsletter';
|
||||
import { getLocale } from 'next-intl/server';
|
||||
import { createSafeActionClient } from 'next-safe-action';
|
||||
import { z } from 'zod';
|
||||
|
||||
@ -28,6 +30,17 @@ export const subscribeNewsletterAction = actionClient
|
||||
};
|
||||
}
|
||||
|
||||
// Send a welcome email to the user
|
||||
const locale = await getLocale();
|
||||
await sendEmail({
|
||||
to: email,
|
||||
template: 'subscribeNewsletter',
|
||||
context: {
|
||||
email,
|
||||
},
|
||||
locale,
|
||||
});
|
||||
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { sendEmail } from '@/mail';
|
||||
import { CheckSubscribeStatusParams, NewsletterProvider, SubscribeNewsletterParams, UnsubscribeNewsletterParams } from '@/newsletter/types';
|
||||
import { Resend } from 'resend';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user