removido e-mail

This commit is contained in:
Luiz H. R. Silva 2024-06-26 10:32:56 -03:00
parent e498c967be
commit caf3f59453
12 changed files with 225 additions and 454 deletions

View file

@ -1,69 +0,0 @@
import nodemailer from "nodemailer"
import { respostaComuns, type tipoResposta } from "p-respostas"
// const confEmail = {
// host: "email-smtp.us-east-1.amazonaws.com",
// port: 587,
// secure: false,
// user: "AKIA2LGJTHGX2ZKMMYHG",
// pass: "BFuchUwoUYYDJK8l+pd1NvZxk70PjhMX+KbQy+5HfPDl",
// requireTLS: true,
// ignoreTLS: false,
// emailDe: "nao-responder@e-licencie.com.br",
// nomeDe: "🌱 Betha Meio Ambiente",
// };
const confEmail = {
host: "email-smtp.us-east-1.amazonaws.com",
port: 587,
secure: false,
user: "AKIA2LGJTHGX2ZKMMYHG",
pass: "BFuchUwoUYYDJK8l+pd1NvZxk70PjhMX+KbQy+5HfPDl",
requireTLS: true,
ignoreTLS: false,
emailDe: "nao-responder@gestao-ambiental-brasil.idz.one",
nomeDe: "🌱 Betha Meio Ambiente",
}
export const enviarEmail = async ({
email,
nome,
assunto,
texto,
htlm,
}: {
email: string
nome?: string
assunto: string
/** Verão em texto do html, não obrigatório */
texto?: string
htlm: string
}): Promise<tipoResposta<string>> => {
const info = await nodemailer
.createTransport({
host: confEmail.host,
port: confEmail.port,
secure: confEmail.secure,
auth: {
user: confEmail.user,
pass: confEmail.pass,
},
})
.sendMail({
from: { address: confEmail.emailDe, name: confEmail.nomeDe },
to: nome ? { address: email, name: nome } : email,
subject: assunto,
text: texto,
html: htlm,
})
.then(() =>
respostaComuns.valor(`Email "${assunto}" enviado para ${email}`),
)
.catch((err) => {
console.error(err)
return respostaComuns.erro(
`Erro ao enviar email para ${email}: ${err.message}`,
)
})
return info
}

View file

@ -4,4 +4,3 @@ export * from "./produtos"
export * from "./pilao-de-dados"
export * from "./residuos"
export * from "./NPS"
export * from "./email"