mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-03-10 04:51:47 +00:00
Correção de integração com o resend
This commit is contained in:
committed by
Felipe Coutinho
parent
446ab0bb38
commit
94f6b0a986
16
lib/email/resend.ts
Normal file
16
lib/email/resend.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { config } from "dotenv";
|
||||
|
||||
/**
|
||||
* Endereço "from" para envio de e-mails via Resend.
|
||||
* Lê RESEND_FROM_EMAIL do .env (valor deve estar entre aspas se tiver espaço:
|
||||
* Garante carregamento do .env no contexto da chamada (ex.: Server Actions).
|
||||
*/
|
||||
const FALLBACK_FROM = "OpenMonetis <noreply@resend.dev>";
|
||||
|
||||
export function getResendFromEmail(): string {
|
||||
// Garantir que .env foi carregado (não sobrescreve variáveis já definidas)
|
||||
config({ path: ".env" });
|
||||
const raw = process.env.RESEND_FROM_EMAIL;
|
||||
const value = typeof raw === "string" ? raw.trim() : "";
|
||||
return value.length > 0 ? value : FALLBACK_FROM;
|
||||
}
|
||||
Reference in New Issue
Block a user