firebase - 通过 firebase 触发电子邮件扩展发送 ICS 文件
问题描述
我正在使用 firebase 触发电子邮件扩展程序有什么办法可以在电子邮件上附加 .ics 文件吗?
我正在使用 ics.js 生成和下载 ics 文件
let cal = ics()
cal.addEvent(this.subject,this.desc,this.medium,this.begin,this.end)
cal.download(this.subject)
我正在使用发送电子邮件
现在我如何在电子邮件中添加生成的 ics 文件
解决方案
尝试这个
firebase.firestore().collection('mail').add({
to: id,
message: {
subject: 'Congratulation!',
text: 'You Have been hired.',
html: 'this is <code>HTML</code> code .',
attachments: [
{
path: '/path/to/file.ext'
},
]
}
})
以下是一些如何附加文件的示例列表
firebase.firestore().collection('mail').add({
to: id,
message: {
subject: 'Congratulation!',
text: 'You Have been hired.',
html: 'this is <code>HTML</code> code .',
attachments: [
{ // utf-8 string as an attachment
filename: 'text1.txt',
content: 'hello world!'
},
{ // binary buffer as an attachment
filename: 'text2.txt',
content: new Buffer('hello world!','utf-8')
},
{ // file on disk as an attachment
filename: 'text3.txt',
path: '/path/to/file.txt' // stream this file
},
{ // filename and content type is derived from path
path: '/path/to/file.txt'
},
{ // stream as an attachment
filename: 'text4.txt',
content: fs.createReadStream('file.txt')
},
{ // define custom content type for the attachment
filename: 'text.bin',
content: 'hello world!',
contentType: 'text/plain'
},
{ // use URL as an attachment
filename: 'license.txt',
path: 'https://raw.github.com/nodemailer/nodemailer/master/LICENSE'
},
{ // encoded string as an attachment
filename: 'text1.txt',
content: 'aGVsbG8gd29ybGQh',
encoding: 'base64'
},
{ // data uri as an attachment
path: 'data:text/plain;base64,aGVsbG8gd29ybGQ='
},
{
// use pregenerated MIME node
raw: 'Content-Type: text/plain\r\n' +
'Content-Disposition: attachment;\r\n' +
'\r\n' +
'Hello world!'
}
]
}
})
有关更多信息,请查看以下链接:
推荐阅读
- vba - 是否有切换动画窗格和/或选择窗格的命令?
- c# - 从列表中取出 30 个随机元素
- node.js - 从 nodejs 中 child_process.spawn 的 stderr 读取所有内容
- c++ - 背包问题变体的递归关系?
- java - Java 中 PreparedStatement 的解决方法 setDate
- python - 如何将普通函数转换为类内的函数?
- html - 想用 Div 替换表格
- node.js - 异步函数 discord.js 中的 awaitMessages
- c# - 网络核心 MVC - 'System.Web' 中不存在'HttpCookie'
- javascript - reactjs - 两个组件之间的通信