Allow separate from and to emails
All checks were successful
Publish Docker Image / Publish Docker Image (push) Successful in 10s

This commit is contained in:
Ahmed Al-Taiar
2024-10-16 21:45:55 -04:00
parent 6540329f36
commit 7973663b2a
7 changed files with 21 additions and 3 deletions

View File

@ -22,6 +22,8 @@ SMTP_HOST=smtp.example.com
SMTP_PORT=465
SMTP_SECURE=true
SMTP_USER=noreply@example.com
EMAIL_FROM=noreply@example.com
EMAIL_TO=email@example.com
SMTP_PASSWORD=password
DOMAIN=example.com

View File

@ -10,6 +10,8 @@ SMTP_HOST=smtp.example.com
SMTP_PORT=465
SMTP_SECURE=true
SMTP_USER=noreply@example.com
EMAIL_FROM=noreply@example.com
EMAIL_TO=email@example.com
SMTP_PASSWORD=password
DOMAIN=example.com

View File

@ -48,6 +48,8 @@ ARG SMTP_PORT
ARG SMTP_SECURE
ARG SMTP_USER
ARG SMTP_PASSWORD
ARG EMAIL_FROM
ARG EMAIL_TO
ARG FIRST_NAME
ARG LAST_NAME

View File

@ -28,6 +28,8 @@ services:
- SMTP_PORT=465
- SMTP_SECURE=true
- SMTP_USER=noreply@example.com
- EMAIL_FROM=noreply@example.com
- EMAIL_TO=email@example.com
- SMTP_PASSWORD=password
- DOMAIN=portfolio.example.com
- API_DOMAIN=api.portfolio.example.com

View File

@ -19,7 +19,7 @@ const transporter = nodemailer.createTransport({
export const sendEmail = async ({ to, subject, text, html }: Options) =>
await transporter.sendMail({
from: `${process.env.FIRST_NAME} ${process.env.LAST_NAME} <${process.env.GMAIL}>`,
from: `${process.env.FIRST_NAME} ${process.env.LAST_NAME} <${process.env.EMAIL_FROM}>`,
to: Array.isArray(to) ? to : [to],
subject,
text,

View File

@ -16,6 +16,8 @@ services:
- SMTP_PORT=465
- SMTP_SECURE=true
- SMTP_USER=noreply@example.com
- EMAIL_FROM=noreply@example.com
- EMAIL_TO=email@example.com
- SMTP_PASSWORD=password
- DOMAIN=portfolio.example.com
- API_DOMAIN=api.portfolio.example.com

View File

@ -9,7 +9,7 @@ export default async () => {
try {
const admin = {
username: 'admin',
email: process.env.GMAIL,
email: process.env.EMAIL_TO,
password: process.env.SMTP_PASSWORD,
}
@ -17,7 +17,7 @@ export default async () => {
const existingAdmin = await db.user.findFirst({
where: {
email: admin.email,
username: admin.username,
},
})
@ -30,6 +30,14 @@ export default async () => {
salt,
},
})
else
await db.user.update({
where: { id: existingAdmin.id },
data: {
username: admin.username,
email: admin.email,
},
})
const titles = await db.titles.findFirst()