From 35aeeca9a28495dd75ac1e94df3d4f8e240b2ea1 Mon Sep 17 00:00:00 2001 From: Web-serfer Date: Mon, 4 May 2026 04:05:35 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lib/email.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/frontend/src/lib/email.ts b/frontend/src/lib/email.ts index 0ad9877..047a0fa 100644 --- a/frontend/src/lib/email.ts +++ b/frontend/src/lib/email.ts @@ -7,16 +7,15 @@ const forceProduction = import.meta.env.PB_POCKETBASE_URL?.includes('avt-back') const isProduction = hasProductionFlag || forceProduction || !isDev; const SMTP_HOST = isProduction - ? (import.meta.env.SMTP_HOST || 'smtp.resend.com') + ? (import.meta.env.SMTP_HOST || 'smtp.yandex.ru') : 'localhost'; const SMTP_PORT = isProduction ? (import.meta.env.SMTP_PORT || '587') : '1025'; const SMTP_AUTH_USER = isProduction ? (import.meta.env.SMTP_AUTH_USER || '') : ''; const SMTP_AUTH_PASS = isProduction ? (import.meta.env.SMTP_AUTH_PASS || '') : ''; -const RESEND_API_KEY = import.meta.env.RESEND_API_KEY || SMTP_AUTH_PASS; const FROM_EMAIL = isProduction - ? (import.meta.env.FROM_EMAIL || 'onboarding@resend.onlinemail.me') + ? (import.meta.env.FROM_EMAIL || 'noreply@localhost') : 'noreply@localhost'; const FROM_NAME = isProduction ? (import.meta.env.FROM_NAME || 'Автоюрист Сургут') : 'Dev'; const SITE_URL = isProduction @@ -26,11 +25,8 @@ const SITE_URL = isProduction let transporter: nodemailer.Transporter | null = null; console.log('[EMAIL] isDev:', isDev); -console.log('[EMAIL] hasProductionFlag:', hasProductionFlag); -console.log('[EMAIL] forceProduction:', forceProduction); console.log('[EMAIL] isProduction:', isProduction); -console.log('[EMAIL] RESEND_API_KEY present:', !!RESEND_API_KEY); -console.log('[EMAIL] Use RESEND_API:', isProduction && !!RESEND_API_KEY); +console.log('[EMAIL] SMTP:', SMTP_HOST, ':', SMTP_PORT); function getTransporter() { if (!transporter) { @@ -94,12 +90,8 @@ function withTimeout(promise: Promise, ms: number): Promise { } export async function sendEmail(options: EmailOptions): Promise { - if (isProduction && RESEND_API_KEY) { - return sendViaResendApi(options); - } - console.log('[NODEMAILER] Sending to:', options.to); - console.log('[NODEMAILER] SMTP config:', { host: SMTP_HOST, port: SMTP_PORT }); + console.log('[NODEMAILER] SMTP config:', { host: SMTP_HOST, port: SMTP_PORT, user: SMTP_AUTH_USER }); try { const info = await withTimeout(