【问题标题】:trigger email google firestore extension触发电子邮件 google firestore 扩展
【发布时间】:2020-10-05 21:28:40
【问题描述】:

我有一个与 firebase 一起使用的 Angular 应用程序。我已经设置了一个联系表格,供人们与我联系 - 我将通过 Firestore 以电子邮件的形式接收这些消息。我正在使用触发电子邮件扩展程序。我正在接收电子邮件,但是,我没有从输入字段中获取所有信息。

  onSubmit() {
    console.log('Your form data : ', this.contactForm.value );
    const {contactFormName, contactFormEmail, contactFormSubject, contactFormMessage} = this.contactForm.value;

    this.af.collection('mail').add({
      to: '#####@gmail.com',
      message :{
  //    name: this.contactForm.value.contactFormName,
  //    email: this.contactForm.value.contactFormEmail,
      subject: this.contactForm.value.contactFormSubject,
      text: this.contactForm.value.contactFormMessage
    }

  })
  .then(res => {
      console.log(res);
      this.contactForm.reset();
  })
  .catch(e => {
      console.log(e);
  })
}}

Firestore 默认只允许消息、HTML 和文本等字段。我想自定义电子邮件,以便名称+电子邮件也显示在电子邮件正文中,但事实并非如此。 Firestore 建议使用车把来做到这一点,但我不清楚如何做。这里有一个链接供参考:

https://firebase.google.com/products/extensions/firestore-send-email

【问题讨论】:

    标签: angular firebase google-cloud-firestore smtp handlebars.js


    【解决方案1】:

    如果我对您的理解正确,您想了解如何使用把手来自定义使用触发电子邮件扩展程序创建的电子邮件的正文。

    您可以使用类似以下的语句:

    app.engine('handlebars', exphbs({defaultLayout: 'main'}));
    app.set('view engine', 'handlebars');
    

    然后选择适合电子邮件上下文的布局。您可以在functions-samples/template-handlebars/functions/index.js 页面上查看整个示例。

    对于实际布局示例,您可以查看A Step By Step Guide To Using Handlebars With Your Node js App

    【讨论】:

      猜你喜欢
      • 2021-06-02
      • 2022-11-20
      • 2021-05-23
      • 2022-11-20
      • 2021-06-21
      • 2020-11-08
      • 2020-11-06
      • 2011-01-05
      • 1970-01-01
      相关资源
      最近更新 更多