简体   繁体   中英

Firebase Sendgrid - unable to send email

I want to use Firebase+Sendgrid in order to send e-mail after user registers on my website. The flow is simple:

Using Firebase send email extension , on every account creation, I'm adding new document to users collection.

      setDoc(newUserRef, {
        to: user.email,
        message: {
          subject: "Hello!",
          text: "test",
          html: "Test <b>Test</b> <i>Test</i>",
        },
      });

This works as intended, since this document is being added to the collection.

However, when i check firestore object, delivery object has

 state: ERROR,
 error: Error: Invalid login: 535 Authentication failed: Bad username / password}

At sendgrids end, I've created API Key, verified sender email, and used that api key while installing "trigger email" firebase extension.

I've set trigger email extension like this:

SMTP Connection URI: smtps:// apikey @smtp.sendgrid.net:465

SMTP password (Optional): apikey

What am i doing wrong?

When using SMTP with SendGrid, your username is the literal string apikey and the password is your API key.

So, your trigger email extension settings should be:

SMTP Connection URI: smtps://apikey@smtp.sendgrid.net:465

SMTP password (Optional): YOUR_API_KEY

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM