import { Injectable } from '@nestjs/common';
import { MailerService } from '@nestjs-modules/mailer';
import { ContactEntity } from '../contact/entities/contact.entity';

@Injectable()
export class MailService {
  constructor(private mailerService: MailerService) {}
  /* SEND QUESTION */
  async sendContact(contact: ContactEntity) {
    const mail = await this.mailerService.sendMail({
      to: 'jorbinogales@gmail.com',
      subject: 'Contacto desdel sitio web',
      template: './contacto',
      context: {
        contact,
      },
    });
    console.log(mail);
    return {
      statusCode: 204,
    };
  }
}
