Sending email "Invalid login" error

I am running through the Sending Emails | RedwoodJS Docs tutorial and when I click the send email button, I get the “Invalid login: 530 Invalid username or password” error.Here’s the stack trace. What could I be missing?

email.ts:

export async function sendEmail({ to, subject, text, html }: Options) {
  console.log('Sending email to:', to)
  // create reusable transporter object using SendInBlue for SMTP
  const transporter = nodemailer.createTransport({
    host: 'smtp-relay.sendinblue.com',
    port: 587,
    secure: false, // true for 465, false for other ports
    auth: {
      user: 'AjitGoel@Gmail.com',
      pass: process.env.SEND_IN_BLUE_KEY,
    },
  })
  // send mail with defined transport object
  const info = await transporter.sendMail({
    from: '"Ajit Goel" <AjitGoel@Gmail.com>',
    to: Array.isArray(to) ? to : [to], // list of receivers
    subject, // Subject line
    text, // plain text body
    html, // html body
  })
  return info
}

Stack Trace:

api | 01:42:39 🌲 incoming request POST xxx /graphql
api | 01:42:39 🐛 Parsing request to extract GraphQL parameters
api | 01:42:39 🐛 Processing GraphQL Parameters
api | 01:42:39 🐛 Execution start
api | 01:42:39 🐛 Received GraphQL operation:
api | 01:42:39 🐛 undefined 
api | 🏷  FindUsers  
api | 🔭 Query
api | "query FindUsers {\n  users {\n    id\n    createdAt\n    updatedAt\n    email\n    name\n    __typename\n  }\n}"
api | 01:42:39 🐛 graphql-server GraphQL execution started: FindUsers
api | 01:42:39 🐛 Execution end
api | 01:42:39 🌲 request completed 15ms
api | 01:42:39 🐛 undefined
api | 01:42:39 🐛 graphql-server GraphQL execution completed: FindUsers
api | 01:42:41 🌲 incoming request POST xxx /graphql
api | 01:42:41 🐛 Parsing request to extract GraphQL parameters
api | 01:42:41 🐛 Processing GraphQL Parameters
api | 01:42:41 🐛 Execution start
api | 01:42:41 🐛 Received GraphQL operation:
api | 01:42:41 🐛 undefined
api | 🏷  FindUserById
api | 🔭 Query
api | "query FindUserById($id: String!) {\n  user: user(id: $id) {\n    id\n    createdAt\n    updatedAt\n    email\n    name\n    __typename\n  }\n}"
api | 01:42:41 🐛 graphql-server GraphQL execution started: FindUserById
api | 01:42:41 🐛 Execution end
api | 01:42:41 🌲 request completed 20ms
api | 01:42:41 🐛 undefined
api | 01:42:41 🐛 graphql-server GraphQL execution completed: FindUserById
api | 01:42:44 🌲 incoming request POST xxx /graphql
api | 01:42:44 🐛 Parsing request to extract GraphQL parameters
api | 01:42:44 🐛 Processing GraphQL Parameters
api | 01:42:44 🐛 Execution start
api | 01:42:44 🐛 Received GraphQL operation:
api | 01:42:44 🐛 undefined 
api | 🏷  EmailUserMutation
api | 🔭 Query
api | "mutation EmailUserMutation($id: String!) {\n  emailUser(id: $id) {\n    id\n    __typename\n  }\n}"
api | 01:42:44 🐛 graphql-server GraphQL execution started: EmailUserMutation
api | Sending email to: AJITGOEL@GMAIL.COM
api | 01:42:44 🐛 Execution end
api | 01:42:44 🌲 request completed 414ms
api | 01:42:44 🐛 undefined
api | 01:42:44 🚨 graphql-server Invalid login: 530 Invalid username or password
api |
api | 🚨 GraphQLError Info
api |
api | {
api |   "path": [
api |     "emailUser"
api |   ],
api |   "locations": [
api |     {
api |       "line": 2,
api |       "column": 3
api |     }
api |   ],
api |   "extensions": {}
api | }
api |
api | 🥞 Error Stack
api |
api | Error: Invalid login: 530 Invalid username or password
api |     at SMTPConnection._formatError (C:\t\email\node_modules\nodemailer\lib\smtp-connection\index.js:790:19)
api |     at SMTPConnection._actionAUTHComplete (C:\t\email\node_modules\nodemailer\lib\smtp-connection\index.js:1542:34)    
api |     at SMTPConnection.<anonymous> (C:\t\email\node_modules\nodemailer\lib\smtp-connection\index.js:546:26)
api |     at SMTPConnection._processResponse (C:\t\email\node_modules\nodemailer\lib\smtp-connection\index.js:953:20)        
api |     at SMTPConnection._onData (C:\t\email\node_modules\nodemailer\lib\smtp-connection\index.js:755:14)
api |     at TLSSocket.SMTPConnection._onSocketData (C:\t\email\node_modules\nodemailer\lib\smtp-connection\index.js:193:44) 
api |     at TLSSocket.emit (node:events:520:28)
api |     at addChunk (node:internal/streams/readable:315:12)
api |     at readableAddChunk (node:internal/streams/readable:289:9)
api |     at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
api |

perhaps its the case, ajitgoel@gmail.com versus AjitGoel@gmail.com, will recheck and let the community know.

so it was an issue with the casing, I have created a PR to update the tutorial.

1 Like