gpt4 book ai didi

node.js - 如何使用nodemailer正确发送 session 请求?

转载 作者:搜寻专家 更新时间:2023-10-31 23:21:43 24 4
gpt4 key购买 nike

我正在尝试使用以下代码通过 nodemailer 发送 session 请求。我面临的问题是 session 邀请将作为附件 ics 文件而不是可以直接添加的请求。我已经在多个邮件客户端上试过了。任何指针将不胜感激。

transport.sendMail({
from: 'BakBak.io <biplav.saraf@gmail.com>',
to: 'biplav.saraf@gmail.com',
subject: 'Meeting',
//html: "Hi",
text: "Hola!!",
alternative: {
contentType: "text/calendar; method=REQUEST; name='meeting.ics';component=VEVENT",
contents: new Buffer(cal.toString()),
contentEncoding:"7bit",
"Content-Class":"urn:content-classes:calendarmessage"
},
headers: {
"Content-Type": "text/calendar",
//"charset":"utf-8",
"method":"REQUEST",
"component":"VEVENT",
"Content-Class":"urn:content-classes:calendarmessage"
}//,
//attachments : [{filename:'invite.ics',contents: cal.toString()}]
}, function(err, responseStatus) {
if (err) {
console.log(err);
res.render('schedule',{errors: err.message});
} else {
console.log(responseStatus.message);
res.render('schedule',{success_msg: "Successfully Created!"});
}
});

最佳答案

如果发件人和收件人相同,Gmail 不会显示 session 请求并提供添加到日历的选项。

这对我有用:

transport.sendMail({
from: 'BakBak.io <biplav.saraf@gmail.com>',
to: 'donateoldspectacles@gmail.com',
subject: 'Meeting',
html: "Hiya!!",
text: "Hola!!",
alternatives: [{
contentType: "text/calendar",
content: new Buffer(ical)
}]
}, function(err, responseStatus) {
if (err) {
console.log(err);
res.render('schedule',{errors: err.message});
} else {
console.log(responseStatus.message);
res.render('schedule',{success_msg: "Successfully Created!"});
}
});

关于node.js - 如何使用nodemailer正确发送 session 请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24323452/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com