removido e-mail
This commit is contained in:
parent
e498c967be
commit
caf3f59453
12 changed files with 225 additions and 454 deletions
9
dist-import/email/index.d.ts
vendored
9
dist-import/email/index.d.ts
vendored
|
|
@ -1,9 +0,0 @@
|
|||
import { type tipoResposta } from "p-respostas";
|
||||
export declare const enviarEmail: ({ email, nome, assunto, texto, htlm, }: {
|
||||
email: string;
|
||||
nome?: string | undefined;
|
||||
assunto: string;
|
||||
/** Verão em texto do html, não obrigatório */
|
||||
texto?: string | undefined;
|
||||
htlm: string;
|
||||
}) => Promise<tipoResposta<string>>;
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
import nodemailer from "nodemailer";
|
||||
import { respostaComuns } 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 = ({ email, nome, assunto, texto, htlm, }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const info = yield 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;
|
||||
});
|
||||
1
dist-import/index.d.ts
vendored
1
dist-import/index.d.ts
vendored
|
|
@ -4,4 +4,3 @@ export * from "./produtos";
|
|||
export * from "./pilao-de-dados";
|
||||
export * from "./residuos";
|
||||
export * from "./NPS";
|
||||
export * from "./email";
|
||||
|
|
|
|||
|
|
@ -4,4 +4,3 @@ export * from "./produtos";
|
|||
export * from "./pilao-de-dados";
|
||||
export * from "./residuos";
|
||||
export * from "./NPS";
|
||||
export * from "./email";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue