Home > database >  What type of email should I use for nodemailer to not get blocked
What type of email should I use for nodemailer to not get blocked

Time:03-23

I tried to figure out the problem, but everything was correctly configured. I'm used gmail, but when I deployed my nodejs website, immediately been blocked. After I tried outlook email, a had a few problems to set up, but worked on localhost, and worked on server too. After a day, when I wanted to try, it was blocked too. What type of email should I use, which is free, and working perfectly with nodemailer and not blocking, when someone want to send email when the website is on a server?

let transporter = nodemailer.createTransport({
      host: "smtp-mail.outlook.com",
      secureConnection: false,
      port: 587,
      tls: {
        ciphers:'SSLv3'
      },
      auth: {
        user: '[email protected]',
        pass: 'xxxx'
      }
    });

  let mailOptions = {
    from: '<[email protected]>',
    to: '[email protected]',
    subject: 'Beküldött recept: '   req.body.recipename,
    text: '',
    html: "",
    attachments: [{
      filename: imageName,
      path: newuploadPath
    }]
  };

CodePudding user response:

I used Zoho mail and it works fine. Make sure to use the same Zoho email address in the from field of mailOptions as it will throw an error otherwise.

var transport = nodemailer.createTransport({
    host: 'smtp.zoho.eu',
    port: 465,
    secure: true, //ssl
    auth: {
        user:process.env.EMAIL,
        pass:process.env.EMAIL_PASSWORD
    }
});

var mailOptions = {
    from: process.env.EMAIL,
    to: req.body.email,
    subject: "Subject",
    html: ""
};

Generally Gmail is not the preferred service to use with Nodemailer since it is targeted at real users and not for automatic/programmed use. See Nodemailer with Gmail for more info. Also here is a list of alternative email services supported by Nodemailer WELL-KNOWN SERVICES.

  • Related