我正在使用Firebase触发电子邮件扩展名,有什么方法可以在电子邮件上附加.ics文件?
我正在使用ics.js生成并直接下载ics文件
let cal = ics()
cal.addEvent(this.subject,this.desc,this.medium,this.begin,this.end)
cal.download(this.subject)
我正在使用以下电子邮件发送电子邮件
firebase.firestore().collection('mail').add({
to: id,
message: {
subject: 'Congratulation!',
text: 'You Have been hired.',
html: 'this is <code>HTML</code> code .',
}
})
})
现在如何在电子邮件中添加生成的ics文件
答案 0 :(得分:0)
尝试一下
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!'
}
]
}
})
有关更多信息,请查看以下链接: