.
This commit is contained in:
parent
e24308aac0
commit
ca59ed74dd
@ -41,6 +41,7 @@ export const LayoutHeader = () => {
|
||||
</Link>
|
||||
{mainMenu.map((menuItem) => (
|
||||
<Link
|
||||
key={menuItem.to}
|
||||
to={menuItem.to}
|
||||
className={cn(
|
||||
"transition-colors text-muted-foreground hover:text-foreground",
|
||||
|
||||
@ -62,5 +62,15 @@ module.exports = {
|
||||
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";
|
||||
|
||||
export class BrevoMailService extends ApplicationService implements IEmailService {
|
||||
private transporter: any;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.transporter = nodemailer.createTransport(config.nodemailer.brevo);
|
||||
}
|
||||
|
||||
async sendMail(mailOptions: ISendEmailOptions, dry?: boolean): Promise<void> {
|
||||
async sendMail(mailOptions: ISendEmailOptions, dry?: boolean): Promise<any> {
|
||||
if (dry) {
|
||||
// No enviar el email
|
||||
new LoggerMailService().sendMail(mailOptions);
|
||||
return;
|
||||
}
|
||||
|
||||
await this.transporter.sendMail({
|
||||
const transporter = nodemailer.createTransport(config.nodemailer.brevo);
|
||||
|
||||
return await transporter.sendMail({
|
||||
...mailOptions,
|
||||
attachments: mailOptions.attachments?.map((att) => ({
|
||||
filename: att.filename,
|
||||
|
||||
@ -14,6 +14,7 @@ import {
|
||||
UniqueID,
|
||||
} from "@shared/contexts";
|
||||
|
||||
import { IInfrastructureError } from "@/contexts/common/infrastructure";
|
||||
import { Dealer } from "@/contexts/sales/domain";
|
||||
import { Incidence } from "../domain";
|
||||
import { ISupportContext } from "../infrastructure";
|
||||
@ -80,17 +81,24 @@ export class SendIncidenceUseCase
|
||||
|
||||
const incidence = incidenceOrError.object;
|
||||
|
||||
this._context.services?.emailService.sendMail({
|
||||
from: {
|
||||
name: user.name.toString(),
|
||||
address: user.email.toString(),
|
||||
},
|
||||
to: this._context.defaults.support.from,
|
||||
subject: this._context.defaults.support.subject,
|
||||
html: incidence.description.toString(),
|
||||
});
|
||||
try {
|
||||
const sendInfo = await this._context.services?.emailService.sendMail({
|
||||
from: {
|
||||
name: user.name.toString(),
|
||||
address: user.email.toString(),
|
||||
},
|
||||
to: this._context.defaults.support.from,
|
||||
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(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user