Node Mailer Error












7














I am using nodemailer in my Firebase Cloud Functions to send a mail when a data is added to the realtime database.



Code:



const functions = require('firebase-functions');
const nodemailer = require('nodemailer');

const gmailEmail = 'myemail.in@gmail.com';
const gmailPassword = 'mypassword';

const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
password: gmailPassword
}
});

const APP_NAME = 'ABC In'

exports.salonCreatedAccount = functions.database.instance('abc-
in').ref('/abc/{def}').onCreate(event => {
const snapshot = event.data;
const val = snapshot.val()
console.log(val);

const email = val.email;
const displayname = val.name;

return sendconfirmationEmail(email, displayname);
});

function sendconfirmationEmail(email, displayName){
const mailOptions = {
from: `${APP_NAME} <abc.in@gmail.com>`,
to: email
};

mailOptions.subject = `Welcome to ${APP_NAME}!`;
mailOptions.text = `Some Text`;
return mailTransport.sendMail(mailOptions).then(() => {
console.log(`New welcome mail sent to ${email}`);
});
}


I am getting this following error while executing.
NOTE: I have made sure that the email and password is right and there's no mistake there.



Error:



Error: Missing credentials for "PLAIN"
at SMTPConnection._formatError (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:591:19)
at SMTPConnection.login (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:340:38)
at connection.connect (/user_code/node_modules/nodemailer/lib/smtp-transport/index.js:270:32)
at SMTPConnection.once (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:188:17)
at SMTPConnection.g (events.js:292:16)
at emitNone (events.js:86:13)
at SMTPConnection.emit (events.js:185:7)
at SMTPConnection._actionEHLO (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:1113:14)
at SMTPConnection._processResponse (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:747:20)
at SMTPConnection._onData (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:543:14)


How do I fix this?










share|improve this question





























    7














    I am using nodemailer in my Firebase Cloud Functions to send a mail when a data is added to the realtime database.



    Code:



    const functions = require('firebase-functions');
    const nodemailer = require('nodemailer');

    const gmailEmail = 'myemail.in@gmail.com';
    const gmailPassword = 'mypassword';

    const mailTransport = nodemailer.createTransport({
    service: 'gmail',
    auth: {
    user: gmailEmail,
    password: gmailPassword
    }
    });

    const APP_NAME = 'ABC In'

    exports.salonCreatedAccount = functions.database.instance('abc-
    in').ref('/abc/{def}').onCreate(event => {
    const snapshot = event.data;
    const val = snapshot.val()
    console.log(val);

    const email = val.email;
    const displayname = val.name;

    return sendconfirmationEmail(email, displayname);
    });

    function sendconfirmationEmail(email, displayName){
    const mailOptions = {
    from: `${APP_NAME} <abc.in@gmail.com>`,
    to: email
    };

    mailOptions.subject = `Welcome to ${APP_NAME}!`;
    mailOptions.text = `Some Text`;
    return mailTransport.sendMail(mailOptions).then(() => {
    console.log(`New welcome mail sent to ${email}`);
    });
    }


    I am getting this following error while executing.
    NOTE: I have made sure that the email and password is right and there's no mistake there.



    Error:



    Error: Missing credentials for "PLAIN"
    at SMTPConnection._formatError (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:591:19)
    at SMTPConnection.login (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:340:38)
    at connection.connect (/user_code/node_modules/nodemailer/lib/smtp-transport/index.js:270:32)
    at SMTPConnection.once (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:188:17)
    at SMTPConnection.g (events.js:292:16)
    at emitNone (events.js:86:13)
    at SMTPConnection.emit (events.js:185:7)
    at SMTPConnection._actionEHLO (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:1113:14)
    at SMTPConnection._processResponse (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:747:20)
    at SMTPConnection._onData (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:543:14)


    How do I fix this?










    share|improve this question



























      7












      7








      7


      1





      I am using nodemailer in my Firebase Cloud Functions to send a mail when a data is added to the realtime database.



      Code:



      const functions = require('firebase-functions');
      const nodemailer = require('nodemailer');

      const gmailEmail = 'myemail.in@gmail.com';
      const gmailPassword = 'mypassword';

      const mailTransport = nodemailer.createTransport({
      service: 'gmail',
      auth: {
      user: gmailEmail,
      password: gmailPassword
      }
      });

      const APP_NAME = 'ABC In'

      exports.salonCreatedAccount = functions.database.instance('abc-
      in').ref('/abc/{def}').onCreate(event => {
      const snapshot = event.data;
      const val = snapshot.val()
      console.log(val);

      const email = val.email;
      const displayname = val.name;

      return sendconfirmationEmail(email, displayname);
      });

      function sendconfirmationEmail(email, displayName){
      const mailOptions = {
      from: `${APP_NAME} <abc.in@gmail.com>`,
      to: email
      };

      mailOptions.subject = `Welcome to ${APP_NAME}!`;
      mailOptions.text = `Some Text`;
      return mailTransport.sendMail(mailOptions).then(() => {
      console.log(`New welcome mail sent to ${email}`);
      });
      }


      I am getting this following error while executing.
      NOTE: I have made sure that the email and password is right and there's no mistake there.



      Error:



      Error: Missing credentials for "PLAIN"
      at SMTPConnection._formatError (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:591:19)
      at SMTPConnection.login (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:340:38)
      at connection.connect (/user_code/node_modules/nodemailer/lib/smtp-transport/index.js:270:32)
      at SMTPConnection.once (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:188:17)
      at SMTPConnection.g (events.js:292:16)
      at emitNone (events.js:86:13)
      at SMTPConnection.emit (events.js:185:7)
      at SMTPConnection._actionEHLO (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:1113:14)
      at SMTPConnection._processResponse (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:747:20)
      at SMTPConnection._onData (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:543:14)


      How do I fix this?










      share|improve this question















      I am using nodemailer in my Firebase Cloud Functions to send a mail when a data is added to the realtime database.



      Code:



      const functions = require('firebase-functions');
      const nodemailer = require('nodemailer');

      const gmailEmail = 'myemail.in@gmail.com';
      const gmailPassword = 'mypassword';

      const mailTransport = nodemailer.createTransport({
      service: 'gmail',
      auth: {
      user: gmailEmail,
      password: gmailPassword
      }
      });

      const APP_NAME = 'ABC In'

      exports.salonCreatedAccount = functions.database.instance('abc-
      in').ref('/abc/{def}').onCreate(event => {
      const snapshot = event.data;
      const val = snapshot.val()
      console.log(val);

      const email = val.email;
      const displayname = val.name;

      return sendconfirmationEmail(email, displayname);
      });

      function sendconfirmationEmail(email, displayName){
      const mailOptions = {
      from: `${APP_NAME} <abc.in@gmail.com>`,
      to: email
      };

      mailOptions.subject = `Welcome to ${APP_NAME}!`;
      mailOptions.text = `Some Text`;
      return mailTransport.sendMail(mailOptions).then(() => {
      console.log(`New welcome mail sent to ${email}`);
      });
      }


      I am getting this following error while executing.
      NOTE: I have made sure that the email and password is right and there's no mistake there.



      Error:



      Error: Missing credentials for "PLAIN"
      at SMTPConnection._formatError (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:591:19)
      at SMTPConnection.login (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:340:38)
      at connection.connect (/user_code/node_modules/nodemailer/lib/smtp-transport/index.js:270:32)
      at SMTPConnection.once (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:188:17)
      at SMTPConnection.g (events.js:292:16)
      at emitNone (events.js:86:13)
      at SMTPConnection.emit (events.js:185:7)
      at SMTPConnection._actionEHLO (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:1113:14)
      at SMTPConnection._processResponse (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:747:20)
      at SMTPConnection._onData (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:543:14)


      How do I fix this?







      node.js firebase firebase-realtime-database google-cloud-functions nodemailer






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 12 at 14:24









      Frank van Puffelen

      227k28371397




      227k28371397










      asked Jan 12 at 13:27









      Sriram R

      565616




      565616
























          5 Answers
          5






          active

          oldest

          votes


















          1














          Solved same error from a local nodejs test app, by what
          @Zaheen replied to: Nodemailer with Gmail and NodeJS
          , part of his reply is copied here:



          var smtpTransport = require('nodemailer-smtp-transport');

          var transporter = nodemailer.createTransport(smtpTransport({
          service: 'gmail',
          host: 'smtp.gmail.com',
          auth: {
          user: 'somerealemail@gmail.com',
          pass: 'realpasswordforaboveaccount'
          }
          }));


          (BTW Accounts with 2FactorAuth cannot enable less secure apps).

          I used nodemailer-smpt-transport, xoauth2, and added host to auth{}.




          Haven't yet done it with Firebase, that's next ... hopefully.. :)






          share|improve this answer





















          • WRT the 2FactorAuth note a useful feature is the app password support.google.com/accounts/answer/185833?hl=en
            – carruthd
            May 23 at 17:11



















          1














          Using nodemailer, you have to providean email and password of the account you are sending the email from, Firebase stores that for you so you don't have to write it directly on your code.
          For that to happen you have to configure the gmail.email and gmail.password Google Cloud environment variables.



          In your console, within the path you store your functions /yourProject/functions$ set your variables this way:



          firebase functions:config:set gmail.email="senderEmail@gmail.com" gmail.password="yourPassword"



          and then you can use it this way:



          const gmailEmail = functions.config().gmail.email;
          const gmailPassword = functions.config().gmail.password;
          const mailTransport = nodemailer.createTransport({
          service: 'gmail',
          auth: {
          user: gmailEmail,
          pass: gmailPassword
          }
          });


          I hope this is helpful for you all , it what was causing the 'missing credentialas plain error' in my case






          share|improve this answer





























            0














            According to the official docs, GMail may disable basic auth in some special cases.




            To prevent having login issues you should either use OAuth2 or use another delivery provider and preferably a dedicated one.




            Read more here: https://nodemailer.com/usage/using-gmail/






            share|improve this answer





















            • But I have allowed google to use less secure authentication methods which should make this work
              – Sriram R
              Jan 12 at 13:37



















            0














            I had this same error and could not find any solution online, until now.



            My solution for this exact error "Missing credentials for "PLAIN"":




            • Go to Authentication in Firebase Console

            • Click on Sign-In Method

            • Select Google

            • Make sure it is enabled


            That solved my error. (Same code as you)






            share|improve this answer





























              0














              Rename password to pass in auth object. for e.g



              const mailTransport = nodemailer.createTransport({
              service: 'gmail',
              auth: {
              user: gmailEmail,
              pass: gmailPassword
              }
              });


              I had the same problem, and solved it like that.



              found out by diving in the code of nodemailer where this message is being logged the code look like this.



                if (this._auth.user && this._auth.pass) { // this condition <---
              this._auth.credentials = {
              user: this._auth.user,
              pass: this._auth.pass
              };
              } else {
              return callback(this._formatError('Missing credentials for "' + this._authMethod + '"', 'EAUTH', false, 'API'));
              }


              Hope this helps :)






              share|improve this answer





















                Your Answer






                StackExchange.ifUsing("editor", function () {
                StackExchange.using("externalEditor", function () {
                StackExchange.using("snippets", function () {
                StackExchange.snippets.init();
                });
                });
                }, "code-snippets");

                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "1"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48227257%2fnode-mailer-error%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                5 Answers
                5






                active

                oldest

                votes








                5 Answers
                5






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                1














                Solved same error from a local nodejs test app, by what
                @Zaheen replied to: Nodemailer with Gmail and NodeJS
                , part of his reply is copied here:



                var smtpTransport = require('nodemailer-smtp-transport');

                var transporter = nodemailer.createTransport(smtpTransport({
                service: 'gmail',
                host: 'smtp.gmail.com',
                auth: {
                user: 'somerealemail@gmail.com',
                pass: 'realpasswordforaboveaccount'
                }
                }));


                (BTW Accounts with 2FactorAuth cannot enable less secure apps).

                I used nodemailer-smpt-transport, xoauth2, and added host to auth{}.




                Haven't yet done it with Firebase, that's next ... hopefully.. :)






                share|improve this answer





















                • WRT the 2FactorAuth note a useful feature is the app password support.google.com/accounts/answer/185833?hl=en
                  – carruthd
                  May 23 at 17:11
















                1














                Solved same error from a local nodejs test app, by what
                @Zaheen replied to: Nodemailer with Gmail and NodeJS
                , part of his reply is copied here:



                var smtpTransport = require('nodemailer-smtp-transport');

                var transporter = nodemailer.createTransport(smtpTransport({
                service: 'gmail',
                host: 'smtp.gmail.com',
                auth: {
                user: 'somerealemail@gmail.com',
                pass: 'realpasswordforaboveaccount'
                }
                }));


                (BTW Accounts with 2FactorAuth cannot enable less secure apps).

                I used nodemailer-smpt-transport, xoauth2, and added host to auth{}.




                Haven't yet done it with Firebase, that's next ... hopefully.. :)






                share|improve this answer





















                • WRT the 2FactorAuth note a useful feature is the app password support.google.com/accounts/answer/185833?hl=en
                  – carruthd
                  May 23 at 17:11














                1












                1








                1






                Solved same error from a local nodejs test app, by what
                @Zaheen replied to: Nodemailer with Gmail and NodeJS
                , part of his reply is copied here:



                var smtpTransport = require('nodemailer-smtp-transport');

                var transporter = nodemailer.createTransport(smtpTransport({
                service: 'gmail',
                host: 'smtp.gmail.com',
                auth: {
                user: 'somerealemail@gmail.com',
                pass: 'realpasswordforaboveaccount'
                }
                }));


                (BTW Accounts with 2FactorAuth cannot enable less secure apps).

                I used nodemailer-smpt-transport, xoauth2, and added host to auth{}.




                Haven't yet done it with Firebase, that's next ... hopefully.. :)






                share|improve this answer












                Solved same error from a local nodejs test app, by what
                @Zaheen replied to: Nodemailer with Gmail and NodeJS
                , part of his reply is copied here:



                var smtpTransport = require('nodemailer-smtp-transport');

                var transporter = nodemailer.createTransport(smtpTransport({
                service: 'gmail',
                host: 'smtp.gmail.com',
                auth: {
                user: 'somerealemail@gmail.com',
                pass: 'realpasswordforaboveaccount'
                }
                }));


                (BTW Accounts with 2FactorAuth cannot enable less secure apps).

                I used nodemailer-smpt-transport, xoauth2, and added host to auth{}.




                Haven't yet done it with Firebase, that's next ... hopefully.. :)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 20 at 4:53









                verNsíon1

                287




                287












                • WRT the 2FactorAuth note a useful feature is the app password support.google.com/accounts/answer/185833?hl=en
                  – carruthd
                  May 23 at 17:11


















                • WRT the 2FactorAuth note a useful feature is the app password support.google.com/accounts/answer/185833?hl=en
                  – carruthd
                  May 23 at 17:11
















                WRT the 2FactorAuth note a useful feature is the app password support.google.com/accounts/answer/185833?hl=en
                – carruthd
                May 23 at 17:11




                WRT the 2FactorAuth note a useful feature is the app password support.google.com/accounts/answer/185833?hl=en
                – carruthd
                May 23 at 17:11













                1














                Using nodemailer, you have to providean email and password of the account you are sending the email from, Firebase stores that for you so you don't have to write it directly on your code.
                For that to happen you have to configure the gmail.email and gmail.password Google Cloud environment variables.



                In your console, within the path you store your functions /yourProject/functions$ set your variables this way:



                firebase functions:config:set gmail.email="senderEmail@gmail.com" gmail.password="yourPassword"



                and then you can use it this way:



                const gmailEmail = functions.config().gmail.email;
                const gmailPassword = functions.config().gmail.password;
                const mailTransport = nodemailer.createTransport({
                service: 'gmail',
                auth: {
                user: gmailEmail,
                pass: gmailPassword
                }
                });


                I hope this is helpful for you all , it what was causing the 'missing credentialas plain error' in my case






                share|improve this answer


























                  1














                  Using nodemailer, you have to providean email and password of the account you are sending the email from, Firebase stores that for you so you don't have to write it directly on your code.
                  For that to happen you have to configure the gmail.email and gmail.password Google Cloud environment variables.



                  In your console, within the path you store your functions /yourProject/functions$ set your variables this way:



                  firebase functions:config:set gmail.email="senderEmail@gmail.com" gmail.password="yourPassword"



                  and then you can use it this way:



                  const gmailEmail = functions.config().gmail.email;
                  const gmailPassword = functions.config().gmail.password;
                  const mailTransport = nodemailer.createTransport({
                  service: 'gmail',
                  auth: {
                  user: gmailEmail,
                  pass: gmailPassword
                  }
                  });


                  I hope this is helpful for you all , it what was causing the 'missing credentialas plain error' in my case






                  share|improve this answer
























                    1












                    1








                    1






                    Using nodemailer, you have to providean email and password of the account you are sending the email from, Firebase stores that for you so you don't have to write it directly on your code.
                    For that to happen you have to configure the gmail.email and gmail.password Google Cloud environment variables.



                    In your console, within the path you store your functions /yourProject/functions$ set your variables this way:



                    firebase functions:config:set gmail.email="senderEmail@gmail.com" gmail.password="yourPassword"



                    and then you can use it this way:



                    const gmailEmail = functions.config().gmail.email;
                    const gmailPassword = functions.config().gmail.password;
                    const mailTransport = nodemailer.createTransport({
                    service: 'gmail',
                    auth: {
                    user: gmailEmail,
                    pass: gmailPassword
                    }
                    });


                    I hope this is helpful for you all , it what was causing the 'missing credentialas plain error' in my case






                    share|improve this answer












                    Using nodemailer, you have to providean email and password of the account you are sending the email from, Firebase stores that for you so you don't have to write it directly on your code.
                    For that to happen you have to configure the gmail.email and gmail.password Google Cloud environment variables.



                    In your console, within the path you store your functions /yourProject/functions$ set your variables this way:



                    firebase functions:config:set gmail.email="senderEmail@gmail.com" gmail.password="yourPassword"



                    and then you can use it this way:



                    const gmailEmail = functions.config().gmail.email;
                    const gmailPassword = functions.config().gmail.password;
                    const mailTransport = nodemailer.createTransport({
                    service: 'gmail',
                    auth: {
                    user: gmailEmail,
                    pass: gmailPassword
                    }
                    });


                    I hope this is helpful for you all , it what was causing the 'missing credentialas plain error' in my case







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Feb 13 at 13:40









                    RamiroIsBack

                    8618




                    8618























                        0














                        According to the official docs, GMail may disable basic auth in some special cases.




                        To prevent having login issues you should either use OAuth2 or use another delivery provider and preferably a dedicated one.




                        Read more here: https://nodemailer.com/usage/using-gmail/






                        share|improve this answer





















                        • But I have allowed google to use less secure authentication methods which should make this work
                          – Sriram R
                          Jan 12 at 13:37
















                        0














                        According to the official docs, GMail may disable basic auth in some special cases.




                        To prevent having login issues you should either use OAuth2 or use another delivery provider and preferably a dedicated one.




                        Read more here: https://nodemailer.com/usage/using-gmail/






                        share|improve this answer





















                        • But I have allowed google to use less secure authentication methods which should make this work
                          – Sriram R
                          Jan 12 at 13:37














                        0












                        0








                        0






                        According to the official docs, GMail may disable basic auth in some special cases.




                        To prevent having login issues you should either use OAuth2 or use another delivery provider and preferably a dedicated one.




                        Read more here: https://nodemailer.com/usage/using-gmail/






                        share|improve this answer












                        According to the official docs, GMail may disable basic auth in some special cases.




                        To prevent having login issues you should either use OAuth2 or use another delivery provider and preferably a dedicated one.




                        Read more here: https://nodemailer.com/usage/using-gmail/







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Jan 12 at 13:30









                        Daniel Diekmeier

                        1,691420




                        1,691420












                        • But I have allowed google to use less secure authentication methods which should make this work
                          – Sriram R
                          Jan 12 at 13:37


















                        • But I have allowed google to use less secure authentication methods which should make this work
                          – Sriram R
                          Jan 12 at 13:37
















                        But I have allowed google to use less secure authentication methods which should make this work
                        – Sriram R
                        Jan 12 at 13:37




                        But I have allowed google to use less secure authentication methods which should make this work
                        – Sriram R
                        Jan 12 at 13:37











                        0














                        I had this same error and could not find any solution online, until now.



                        My solution for this exact error "Missing credentials for "PLAIN"":




                        • Go to Authentication in Firebase Console

                        • Click on Sign-In Method

                        • Select Google

                        • Make sure it is enabled


                        That solved my error. (Same code as you)






                        share|improve this answer


























                          0














                          I had this same error and could not find any solution online, until now.



                          My solution for this exact error "Missing credentials for "PLAIN"":




                          • Go to Authentication in Firebase Console

                          • Click on Sign-In Method

                          • Select Google

                          • Make sure it is enabled


                          That solved my error. (Same code as you)






                          share|improve this answer
























                            0












                            0








                            0






                            I had this same error and could not find any solution online, until now.



                            My solution for this exact error "Missing credentials for "PLAIN"":




                            • Go to Authentication in Firebase Console

                            • Click on Sign-In Method

                            • Select Google

                            • Make sure it is enabled


                            That solved my error. (Same code as you)






                            share|improve this answer












                            I had this same error and could not find any solution online, until now.



                            My solution for this exact error "Missing credentials for "PLAIN"":




                            • Go to Authentication in Firebase Console

                            • Click on Sign-In Method

                            • Select Google

                            • Make sure it is enabled


                            That solved my error. (Same code as you)







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jan 26 at 9:08









                            Anders Ekman

                            77211




                            77211























                                0














                                Rename password to pass in auth object. for e.g



                                const mailTransport = nodemailer.createTransport({
                                service: 'gmail',
                                auth: {
                                user: gmailEmail,
                                pass: gmailPassword
                                }
                                });


                                I had the same problem, and solved it like that.



                                found out by diving in the code of nodemailer where this message is being logged the code look like this.



                                  if (this._auth.user && this._auth.pass) { // this condition <---
                                this._auth.credentials = {
                                user: this._auth.user,
                                pass: this._auth.pass
                                };
                                } else {
                                return callback(this._formatError('Missing credentials for "' + this._authMethod + '"', 'EAUTH', false, 'API'));
                                }


                                Hope this helps :)






                                share|improve this answer


























                                  0














                                  Rename password to pass in auth object. for e.g



                                  const mailTransport = nodemailer.createTransport({
                                  service: 'gmail',
                                  auth: {
                                  user: gmailEmail,
                                  pass: gmailPassword
                                  }
                                  });


                                  I had the same problem, and solved it like that.



                                  found out by diving in the code of nodemailer where this message is being logged the code look like this.



                                    if (this._auth.user && this._auth.pass) { // this condition <---
                                  this._auth.credentials = {
                                  user: this._auth.user,
                                  pass: this._auth.pass
                                  };
                                  } else {
                                  return callback(this._formatError('Missing credentials for "' + this._authMethod + '"', 'EAUTH', false, 'API'));
                                  }


                                  Hope this helps :)






                                  share|improve this answer
























                                    0












                                    0








                                    0






                                    Rename password to pass in auth object. for e.g



                                    const mailTransport = nodemailer.createTransport({
                                    service: 'gmail',
                                    auth: {
                                    user: gmailEmail,
                                    pass: gmailPassword
                                    }
                                    });


                                    I had the same problem, and solved it like that.



                                    found out by diving in the code of nodemailer where this message is being logged the code look like this.



                                      if (this._auth.user && this._auth.pass) { // this condition <---
                                    this._auth.credentials = {
                                    user: this._auth.user,
                                    pass: this._auth.pass
                                    };
                                    } else {
                                    return callback(this._formatError('Missing credentials for "' + this._authMethod + '"', 'EAUTH', false, 'API'));
                                    }


                                    Hope this helps :)






                                    share|improve this answer












                                    Rename password to pass in auth object. for e.g



                                    const mailTransport = nodemailer.createTransport({
                                    service: 'gmail',
                                    auth: {
                                    user: gmailEmail,
                                    pass: gmailPassword
                                    }
                                    });


                                    I had the same problem, and solved it like that.



                                    found out by diving in the code of nodemailer where this message is being logged the code look like this.



                                      if (this._auth.user && this._auth.pass) { // this condition <---
                                    this._auth.credentials = {
                                    user: this._auth.user,
                                    pass: this._auth.pass
                                    };
                                    } else {
                                    return callback(this._formatError('Missing credentials for "' + this._authMethod + '"', 'EAUTH', false, 'API'));
                                    }


                                    Hope this helps :)







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Nov 12 at 10:55









                                    Shahzaib Sheikh

                                    337213




                                    337213






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.





                                        Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                        Please pay close attention to the following guidance:


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48227257%2fnode-mailer-error%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Florida Star v. B. J. F.

                                        Danny Elfman

                                        Lugert, Oklahoma