.
This commit is contained in:
parent
e24308aac0
commit
ca59ed74dd
@ -41,6 +41,7 @@ export const LayoutHeader = () => {
|
|||||||
</Link>
|
</Link>
|
||||||
{mainMenu.map((menuItem) => (
|
{mainMenu.map((menuItem) => (
|
||||||
<Link
|
<Link
|
||||||
|
key={menuItem.to}
|
||||||
to={menuItem.to}
|
to={menuItem.to}
|
||||||
className={cn(
|
className={cn(
|
||||||
"transition-colors text-muted-foreground hover:text-foreground",
|
"transition-colors text-muted-foreground hover:text-foreground",
|
||||||
|
|||||||
@ -62,5 +62,15 @@ module.exports = {
|
|||||||
language: "en",
|
language: "en",
|
||||||
},
|
},
|
||||||
|
|
||||||
nodemailer: {},
|
nodemailer: {
|
||||||
|
brevo: {
|
||||||
|
host: "smtp-relay.brevo.com",
|
||||||
|
port: 587,
|
||||||
|
secure: false,
|
||||||
|
auth: {
|
||||||
|
user: "7d0c4e002@smtp-brevo.com",
|
||||||
|
pass: "VOqwt0gBdNPhr781",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,21 +4,16 @@ import { ApplicationService, IEmailService, ISendEmailOptions } from "../../appl
|
|||||||
import { LoggerMailService } from "./LoggerMailService";
|
import { LoggerMailService } from "./LoggerMailService";
|
||||||
|
|
||||||
export class BrevoMailService extends ApplicationService implements IEmailService {
|
export class BrevoMailService extends ApplicationService implements IEmailService {
|
||||||
private transporter: any;
|
async sendMail(mailOptions: ISendEmailOptions, dry?: boolean): Promise<any> {
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.transporter = nodemailer.createTransport(config.nodemailer.brevo);
|
|
||||||
}
|
|
||||||
|
|
||||||
async sendMail(mailOptions: ISendEmailOptions, dry?: boolean): Promise<void> {
|
|
||||||
if (dry) {
|
if (dry) {
|
||||||
// No enviar el email
|
// No enviar el email
|
||||||
new LoggerMailService().sendMail(mailOptions);
|
new LoggerMailService().sendMail(mailOptions);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.transporter.sendMail({
|
const transporter = nodemailer.createTransport(config.nodemailer.brevo);
|
||||||
|
|
||||||
|
return await transporter.sendMail({
|
||||||
...mailOptions,
|
...mailOptions,
|
||||||
attachments: mailOptions.attachments?.map((att) => ({
|
attachments: mailOptions.attachments?.map((att) => ({
|
||||||
filename: att.filename,
|
filename: att.filename,
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import {
|
|||||||
UniqueID,
|
UniqueID,
|
||||||
} from "@shared/contexts";
|
} from "@shared/contexts";
|
||||||
|
|
||||||
|
import { IInfrastructureError } from "@/contexts/common/infrastructure";
|
||||||
import { Dealer } from "@/contexts/sales/domain";
|
import { Dealer } from "@/contexts/sales/domain";
|
||||||
import { Incidence } from "../domain";
|
import { Incidence } from "../domain";
|
||||||
import { ISupportContext } from "../infrastructure";
|
import { ISupportContext } from "../infrastructure";
|
||||||
@ -80,17 +81,24 @@ export class SendIncidenceUseCase
|
|||||||
|
|
||||||
const incidence = incidenceOrError.object;
|
const incidence = incidenceOrError.object;
|
||||||
|
|
||||||
this._context.services?.emailService.sendMail({
|
try {
|
||||||
from: {
|
const sendInfo = await this._context.services?.emailService.sendMail({
|
||||||
name: user.name.toString(),
|
from: {
|
||||||
address: user.email.toString(),
|
name: user.name.toString(),
|
||||||
},
|
address: user.email.toString(),
|
||||||
to: this._context.defaults.support.from,
|
},
|
||||||
subject: this._context.defaults.support.subject,
|
to: this._context.defaults.support.from,
|
||||||
html: incidence.description.toString(),
|
subject: this._context.defaults.support.subject,
|
||||||
});
|
html: incidence.description.toString(),
|
||||||
|
});
|
||||||
|
|
||||||
return Result.ok<void>();
|
console.log(sendInfo);
|
||||||
|
|
||||||
|
return Result.ok<void>();
|
||||||
|
} catch (error: unknown) {
|
||||||
|
const _error = error as IInfrastructureError;
|
||||||
|
return Result.fail(UseCaseError.create(UseCaseError.UNEXCEPTED_ERROR, _error.message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _tryIncidenceInstance(
|
private _tryIncidenceInstance(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user