我正在使用 Firebase,并正在寻找一种在特定触发器上生成 iCal/vcs 文件的方法。我一直在调查ics.js但我不确定这是否是正确的方法。
背景
因此,用户使用应用创建一个事件,该事件会发送到 Firebase,这应该会触发一个事件(触发器已存在),其中日历邀请是通过 nodemailer 发送的
这可能吗?
最佳答案
创建邮件传输
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
创建校准事件
// Create ical object
let cal = ical();
const event = cal.createEvent({
start: event_start,
summary: event_name,
end: new Date(event_start.getTime() + 3600000),
location: address
});
event.organizer({
name: author_name,
email: author_email,
mailto: author_email
});
// Update event description
event.description(email_text);
// Set up mail options
const mailOptions = {
from: `"Your corp." <${gmailEmail}`,
to: user_email,
subject: `Here is your event"`,
text: email_text,
icalEvent: {
method: 'request',
content: new Buffer(cal.toString())
}
};
// Send mailOptions
mailTransport.sendMail(mailOptions).then(() => console.log(`Invite sent`
.catch((error) => console.error('There was an error while sending the email:', error));
关于javascript - 通过 Firebase 函数生成日历邀请,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46970106/