const nodemailer = require("nodemailer");

async function testBrevoSMTP() {
  try {
    // Create a transporter with Brevo SMTP settings
    const transporter = nodemailer.createTransport({
      host: "smtp-relay.brevo.com",
      port: 587,
      auth: {
        user: "94a43c001@smtp-brevo.com", // Use the login from your dashboard
        pass: "xsmtpsib-e61c536d7f4556896f989577868b7a291b062d3dc1020952275457a31c44574b-hT1xCGJcSHUBpNRA", // Use the Sender key
      },
    });

    // Define email options
    const mailOptions = {
      from: '"Humanizer" <farrukhnexgen@gmail.com>', // Sender name and email
      to: "malikfarrukh572@gmail.com", // Recipient email
      subject: "Test Brevo SMTP",
      html: "<h1>Test Email</h1><p>This is a test email from Brevo SMTP.</p>",
    };

    // Send the email
    const info = await transporter.sendMail(mailOptions);
    console.log("Email sent successfully:", info);
  } catch (error) {
    console.error("SMTP test failed:", error);
  }
}

testBrevoSMTP();