Testing Emails

To test email functionality without sending real emails, use services like Mailtrap or Ethereal. These services provide a fake SMTP server to capture and view emails.

Configure Mailtrap:

let transporter = nodemailer.createTransport({
    host: 'smtp.mailtrap.io',
    port: 2525,
    auth: {
        user: process.env.MAILTRAP_USER,
        pass: process.env.MAILTRAP_PASS
    }
});

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *