angular - 触发电子邮件谷歌 Firestore 扩展
问题描述
我有一个与firebase一起使用的角度应用程序。我已经设置了一个联系表格,供人们与我联系 - 我将通过 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
解决方案
如果我对您的理解正确,您想了解如何使用把手来自定义使用触发电子邮件扩展程序创建的电子邮件的正文。
您可以使用类似于以下的语句:
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。
推荐阅读
- php - FosUserBundle 模拟外部
- css - 为什么 CSS background-image url 不显示我的图像,尽管链接和路径是正确的?
- windows - 是否可以使用 AWS 运行普通的 Windows 10 机器?
- php - 使用 UPDATE 不会将图像加载到我的数据库
- php - Laravel 5.4 Query Builder 数组到字符串的转换
- php - PHP:从 WSDL 访问另一个数组中的对象内的数组
- php - How to fix Yii2 Contact Widget Problem on View Pages
- docker - 如何在没有互联网连接的情况下启动 Docker?
- node.js - 如何使用 SMTP 使用 nodemailer 发送邮件
- javascript - 如何从嵌套回调中对 contentScript 做出响应