1

I am trying to send email using firebase mail extensiton. I am using sendGrid to send the email.

when I tried to write "SMTP connection URI" on the extension, it gives error.

smtps://apikey:SG.E9Ln3Lr1SVeiRzJe***********************-*******@smtp.sendgrid.net:465

this is my uri.

I am writing "apikey" for username. is it correct or not?

Firebase do not accept this. When I delete ":", it accepts or if I delete "apikey:", it accepts.

What should I do? can someone help me please? thanks

enter image description here

kadir yapar
  • 65
  • 1
  • 9

2 Answers2

2

My understanding here is that your API Key should be added to the SMTP password field, where it will be securely stored in Google Secrets Manager (rather than being stored in the less secure Firebase Extensions configuration.

So, you should enter the SMTP connection URI with just the username, like:

smtps://apikey@smtp.sendgrid.net:465

and then the SMTP password should be your SendGrid API Key.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • This seems to work, but for anyone who already had installed the extension, note that I had to uninstall and reinstall it to change the SMTP password (setting it during configuration). – jcodes Aug 25 '23 at 17:46
1

From quickly looking at the source for the extension (yay open source), it seems that it only expects username/password credentials inits connection strings.

That does seem to be only a limit of the regular expression using to validate the value you entered, as (as far as I can quickly see) the value is just passed along to nodemailer (and from there to sendgrid) after it's been validated.

So I recommend either filing a feature request on the repo to make the regex accept your credentials format too, or forking the extension and tweaking the regex to your needs. If you do the latter and get it working, I'm quite sure the team would appreciate a PR with the changes. :)

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • sorry, but I do not understand your answer. all of the examples I checked that smtp uri something like that even in the sendgrid documantation. But I do not understand why firebase gives error. thanks your answer by the way. – kadir yapar Mar 10 '22 at 18:30