<commit_before>const nodemailer = require('nodemailer')

// TODO: Env Var
const fromEmail = process.env.FROM_EMAIL;
const fromPassword = process.env.FROM_PASSWORD;

exports.handler = async function (event) {
    console.log(event)
    const transporter = nodemailer.createTransport({
        host: 'smtp.zoho.com',
        port: 465,
        secure: true,
        auth: {
            user: fromEmail,
            pass: <PASSWORD>
        }
    })

    await transporter.sendMail({
        from: `"<NAME>" <${fromEmail}>`,
        to: '<EMAIL>',
        subject: 'Hello',
        text: event.body,
        html: event.body
    })

    console.log('Sent!')
}<commit_msg>Update mail to get info from body<commit_after>const nodemailer = require('nodemailer')

// TODO: Env Var
const fromEmail = process.env.FROM_EMAIL;
const fromPassword = process.env.FROM_PASSWORD;

exports.handler = async function (event) {
    const body = JSON.parse(event.body);

    if (body.email == null || body.email.length < 2) {
        console.error(`An email can't have 3 chars. Received: '${body.email}'`)
        return;
    }

    if (body.message == null || body.message.length < 5) {
        console.error(`A message must have more than 5 chars. Received: '${body.message}'`)
    }

    const transporter = nodemailer.createTransport({
        host: 'smtp.zoho.com',
        port: 465,
        secure: true,
        auth: {
            user: fromEmail,
            pass: <PASSWORD>
        }
    })

    const message = `Message de: ${body.name}, avec le courriel: ${body.email}\n\n${message}, en date du: ${body.date}`;
    await transporter.sendMail({
        from: `"dianeouellet.ca" <${fromEmail}>`,
        to: fromEmail,
        subject: `Message de ${body.name} (${body.email})`,
        text: message,
        html: message
    })
}
{'fraction_non_alphanumeric': 0.1426220515633571, 'fraction_numerical': 0.005485463521667581, 'mean_word_length': 2.4350282485875705, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3689639', 'n_tokens_mistral': 587, 'n_tokens_neox': 562, 'n_words': 142}