小编Jaa*_*hdi的帖子

Firebase云功能中的参数HTTPS

如何在Firebase中的HTTPS功能上设置一些参数?我正在构建一个应用程序,在构建应用程序时,我设法增加了我的邮件列表.现在我想发送邮件,但我想确保在我发送邮件之前可以取消订阅.

我正在使用Firebase进行所有操作,并且我设法创建了一个向每个订阅邮件发送邮件的函数.

我也能够"取消订阅"特定邮件,但这是硬编码,而不是最佳解决方案.

exports.testUnsub = functions.https.onRequest((req, res) => {
  var db = admin.database();
  var ref = db.ref("mailingList/-KhBOisltrOmv57Mrzus");
  ref.child("subscribed").set(false);
  console.log("-KhBOisltrOmv57Mrzus has unsubscribed from mailing list.");
});
Run Code Online (Sandbox Code Playgroud)

在我发送的邮件中有一个URL,它会触发此HTTPS功能.我想在该URL上设置一个参数,使其变为动态的.就像是:

https://us-central1-<project-id>.cloudfunctions.net/testUnsub?listID=xxxxxxxxxxx
Run Code Online (Sandbox Code Playgroud)

我正在寻找可以让我朝着正确方向前进的任何事情.

node.js firebase google-cloud-functions

15
推荐指数
1
解决办法
9367
查看次数

带有 Gmail“发件人:地址”的 Nodemailer 不会更改

我正在尝试向我的邮件列表中的任何新订阅者发送电子邮件。一切正常,但“发件人”电子邮件地址不会更改为“noreplay”。它仍然是我进行身份验证的电子邮件,在本例中是我的工作邮件。例如,如果我将“from”设置为“noreply@example” .com”它从“jaafar@example.com”发送邮件。这是我的代码:

if (snapshot.child("subscribed").val() === 'true') {
  var value = snapshot.child("email").val(); //ignore this
  var key = snapshot.key;  //ignore this

  var mailHtml = val.htmlText1 + httpLink + key + val.htmlText2; //ignore this
  let mailOptions = {
   from: '"JaafarsCompany" <noreply@jaafarsCompany.io>', // sender address
   to: value, // list of receivers
   subject: 'Hello', // Subject line
   text: 'Hello world', // plain text body
   html: mailHtml //ignore this
  };

  // send mail with defined transport object
  mailTransport.sendMail(mailOptions, (error, info) => {
   if (error) {
     return …
Run Code Online (Sandbox Code Playgroud)

node.js firebase nodemailer google-cloud-functions

3
推荐指数
1
解决办法
5917
查看次数