使用 sendGrid 的 firebase 邮件扩展
我正在尝试使用 firebase 邮件扩展发送电子邮件。我正在使用 sendGrid 发送电子邮件。
当我尝试在扩展名上写入“SMTP 连接 URI”时,出现错误。
smtps://apikey:SG.E9Ln3Lr1SVeiRzJe************************-********@smtp.sendgrid.net:465
这是我的乌里。
我正在为用户名写“apikey”。这是否正确?
Firebase 不接受这一点。当我删除“:”时,它接受,或者如果我删除“apikey:”,它接受。
我应该怎么办?有人可以帮我吗?谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的理解是,您的 API 密钥应添加到 SMTP 密码 字段,它将安全地存储在 Google Secrets Manager(而不是存储在安全性较低的 Firebase Extensions 配置中。
因此,您应该仅输入包含用户名的 SMTP 连接 URI,例如:
然后是 SMTP 密码应该是您的 SendGrid API 密钥。
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:
and then the SMTP password should be your SendGrid API Key.
快速查看源扩展(是的开源),看起来它只需要用户名/密码凭据来初始化其连接字符串。
这确实似乎只是用于验证您输入的值的正则表达式的限制,因为(据我可以快速看到)该值只是传递给nodemailer(并从那里传递到sendgrid)经过验证后。
因此,我建议在存储库上提交功能请求以使正则表达式也接受您的凭据格式,或者分叉扩展并根据您的需要调整正则表达式。如果您执行后者并使其正常工作,我确信团队会感谢有关更改的 PR。 :)
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. :)