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
CodePudding user response:
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. :)
CodePudding user response:
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://[email protected]:465
and then the SMTP password should be your SendGrid API Key.