add email information as env

This commit is contained in:
mike.michel 2024-09-03 10:06:41 +02:00
parent 162ae71a5e
commit b0243af07a
2 changed files with 9 additions and 2 deletions

View File

@ -45,4 +45,6 @@ PINTEREST_CLIENT_ID=""
PINTEREST_CLIENT_SECRET=""
DRIBBBLE_CLIENT_ID=""
DRIBBBLE_CLIENT_SECRET=""
IS_GENERAL="true"
IS_GENERAL="true"
EMAIL_FROM_ADDRESS=""
EMAIL_FROM_NAME=""

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,