这个问题可能由于O365 Graph的代码与某些邮箱设置冲突而引起。要解决这个问题,可以尝试更改代码以利用O365 Graph API的不同特性来下载邮件。
例如,使用如下代码:
const graph = require('@microsoft/microsoft-graph-client');
const client = graph.Client.init({
authProvider: (done) => {
done(null, myAccessToken);
}
});
client
.api(`/me/messages/${messageId}/$value`)
.responseType('arraybuffer')
.get((err, rawMessage) => {
if (err) {
console.error('Error downloading message.', err);
return;
}
console.log(rawMessage);
});
其中,messageId
是邮件ID,myAccessToken
是O365 Graph API的访问令牌。
这种方法可能会更好地处理奇怪的错误,而不必在所有邮箱上进行更改。