import env from '#start/env';
import { contactValidator } from '#validators/contact';
import mail from '@adonisjs/mail/services/main';
export default class ContactsController {
    async contact_us({ request }) {
        const data = await contactValidator.validate(request.all());
        await mail.send((message) => {
            message
                .to(env.get('CONTACT_EMAIL'))
                .from(env.get('SMTP_USERNAME'))
                .subject(`CONTACTO CERAMIPEGO WEB - ${data.subject}`)
                .htmlView('emails/contact_to', {
                name: data.name,
                lastName: data.lastName,
                email: data.email,
                phone: data.phone,
                subject: data.subject,
                message: data.message,
            });
        });
        await mail.send((message) => {
            message
                .to(data.email)
                .from(env.get('SMTP_USERNAME'))
                .subject('Recibimos tu mensaje de contacto')
                .htmlView('emails/contact_success', {
                appName: env.get('APP_NAME'),
                name: data.name,
                subject: data.subject,
                message: data.message,
            });
        });
        return true;
    }
}
//# sourceMappingURL=contacts_controller.js.map