Merge pull request #187 from MikeMichel/email

add email information as env
This commit is contained in:
Nevo David 2024-09-05 00:11:50 +07:00 committed by GitHub
commit 179240c701
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -46,4 +46,6 @@ PINTEREST_CLIENT_SECRET=""
DRIBBBLE_CLIENT_ID=""
DRIBBBLE_CLIENT_SECRET=""
IS_GENERAL="true"
NEXT_PUBLIC_POLOTNO="Polotno key for the gallery"
EMAIL_FROM_ADDRESS=""
EMAIL_FROM_NAME=""
NEXT_PUBLIC_POLOTNO="Polotno key for the gallery"

View File

@ -11,9 +11,14 @@ export class EmailService {
return;
}
if (!process.env.EMAIL_FROM_ADDRESS || !process.env.EMAIL_FROM_NAME) {
console.log('Email sender information not found in environment variables');
return;
}
console.log('Sending email to', to);
const sends = await resend.emails.send({
from: process.env.IS_GENERAL === 'true' ? 'Nevo <nevo@postiz.com>' : 'Nevo <nevo@postiz.com>',
from: `${process.env.EMAIL_FROM_NAME} <${process.env.EMAIL_FROM_ADDRESS}>`,
to,
subject,
html,