Hector
Hector

Reputation: 668

Password trouble in nodemailer and node

I am using nodemailer with gmail and I need to include my password somehow. The issue is that my password contains both single and double quotes. e.g. my"annoying'password.

I've tried to escape either of the quotes, but Google refuses my password. "my\"annoying'password"

'my"annoying\'password'

I can login just fine, but I can't use it in my script.

Here is the code creating the mailer object.

var mailer = email.createTransport({
  service : "gmail",
  auth    : {
    user     : "[email protected]",

    // neither of these work
    password : "my\"annoying'password",
    // password : 'my"annoying\'password',
  }
});

Is this possible or am I going to have to change my password?

UPDATE

The error I get is:

[Error: Invalid login]
  code: 'EAUTH',
  response: '535-5.7.8 Username and Password not accepted.

Upvotes: 2

Views: 2878

Answers (1)

Hector
Hector

Reputation: 668

Sorry. Me being stupid.

var mailer = email.createTransport({
  service : "gmail",
  auth    : {
    user     : "[email protected]",

    // neither of these work
    pass : "my\"annoying'password",
    // pass : 'my"annoying\'password',
  }
});

Not

var mailer = email.createTransport({
  service : "gmail",
  auth    : {
    user     : "[email protected]",

    // neither of these work
    password : "my\"annoying'password",
    // password : 'my"annoying\'password',
  }
});

Notice that password: changed to pass:

Upvotes: 4

Related Questions