Новые правки в компоненты
This commit is contained in:
parent
71da9d3143
commit
6e935a9099
2 changed files with 17 additions and 79 deletions
|
|
@ -1,17 +1,8 @@
|
|||
import type { APIRoute } from 'astro';
|
||||
import nodemailer from 'nodemailer';
|
||||
import { sendEmail } from '../../../lib/email';
|
||||
|
||||
const PB_POCKETBASE_URL = import.meta.env.PB_POCKETBASE_URL; // || 'http://localhost:8090';
|
||||
const SMTP_HOST = import.meta.env.SMTP_HOST; // || 'localhost';
|
||||
const SMTP_PORT = import.meta.env.SMTP_PORT; // || '1025';
|
||||
const NOTIFY_EMAIL = import.meta.env.NOTIFY_EMAIL; // || 'info@avtourist.ru';
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: SMTP_HOST,
|
||||
port: parseInt(SMTP_PORT),
|
||||
secure: false,
|
||||
ignoreTLS: true,
|
||||
});
|
||||
const PB_POCKETBASE_URL = import.meta.env.PB_POCKETBASE_URL;
|
||||
const NOTIFY_EMAIL = import.meta.env.NOTIFY_EMAIL || 'redibedi2019@gmail.com';
|
||||
|
||||
const RATE_LIMIT_WINDOW = 60 * 1000;
|
||||
const MAX_REQUESTS = 3;
|
||||
|
|
@ -140,13 +131,11 @@ export const POST: APIRoute = async ({ request }) => {
|
|||
`.trim();
|
||||
|
||||
try {
|
||||
await transporter.sendMail({
|
||||
from: 'avtourist@surgut.ru',
|
||||
await sendEmail({
|
||||
to: NOTIFY_EMAIL,
|
||||
subject: `Новая заявка от ${name}`,
|
||||
html: emailHtml,
|
||||
});
|
||||
console.log('Email notification sent');
|
||||
} catch (emailError) {
|
||||
console.error('Email send error:', emailError);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue