Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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: 'example@outlook.com',
        pass: 'xxxx'
      }
    });

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

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading