OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Gmail with Heroku to send mail

  • Thread starter Thread starter Ethanolle
  • Start date Start date
E

Ethanolle

Guest
I want to add to my web app that after order I'm sending a mail.

I choose Nodemailer because it's the most famous npm to use.

I coded my request and in the local environment, it's working.

I uploaded the code to Heroku and I get an Error.


I checked people told me to disable the captcha wish I did here: UnlockCaptcha

And now I still get the same error, and I get a mail that google blocked the connection what can I do?


Code:
const nodemailer = require('nodemailer');
const { sendLog } = require('../middleware/sendLog');
const { coupons, actions } = require('../constant/actionCoupon');

var simple = function () {
  var textMultiple = {
    text1: 'text1',
    text2: 'text2',
  };
  return textMultiple;
};
// send mail system for the (REQUEST ACCEPTED SYSTEM)
const sendMail = (mail, action) => {
  let mailTransporter = nodemailer.createTransport({
    service: 'gmail',
    auth: {
      user: process.env.MAIL,
      pass: process.env.PASSWORD,
    },
  });

  let mailDetails = {
    from: process.env.MAIL,
    to: mail,
    subject: `Thank you for your purchase. with love FameGoal`,
    text: "for any probleme please reply on this message",
  };

  mailTransporter.sendMail(mailDetails, function (err, data) {
    if (err) {
      console.log(err);
      console.log(`error sent mail to ${mail}`, 'error');
    } else {
      console.log('succeed');
      console.log(`succesfully sent mail to ${mail}`, 'info');
    }
  });
};

exports.sendMail = sendMail;

<p>I want to add to my web app that after order I'm sending a mail.</p>
<p>I choose Nodemailer because it's the most famous npm to use.</p>
<p>I coded my request and in the local environment, it's working.</p>
<p>I uploaded the code to Heroku and I get an Error.</p>
<blockquote>
<p>Error: Invalid login: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbs</p>
</blockquote>
<p>I checked people told me to disable the captcha wish I did here: <a href="https://accounts.google.com/b/0/DisplayUnlockCaptcha" rel="nofollow noreferrer">UnlockCaptcha</a></p>
<p>And now I still get the same error, and I get a mail that google blocked the connection what can I do?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const nodemailer = require('nodemailer');
const { sendLog } = require('../middleware/sendLog');
const { coupons, actions } = require('../constant/actionCoupon');

var simple = function () {
var textMultiple = {
text1: 'text1',
text2: 'text2',
};
return textMultiple;
};
// send mail system for the (REQUEST ACCEPTED SYSTEM)
const sendMail = (mail, action) => {
let mailTransporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: process.env.MAIL,
pass: process.env.PASSWORD,
},
});

let mailDetails = {
from: process.env.MAIL,
to: mail,
subject: `Thank you for your purchase. with love FameGoal`,
text: "for any probleme please reply on this message",
};

mailTransporter.sendMail(mailDetails, function (err, data) {
if (err) {
console.log(err);
console.log(`error sent mail to ${mail}`, 'error');
} else {
console.log('succeed');
console.log(`succesfully sent mail to ${mail}`, 'info');
}
});
};

exports.sendMail = sendMail;</code></pre>
</div>
</div>
</p>
 

Latest posts

Top