sendMail函数似乎不适用于Microsoft graph [英] sendMail Function seem not working with Microsoft graph

查看:72
本文介绍了sendMail函数似乎不适用于Microsoft graph的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 https://github.com/microsoftgraph/nodejs-connect-rest-样本

我可以通过第一步登录,并且已经看到我的Microsoft帐户名,但是当我单击发送测试电子邮件时,它不起作用

i can signin through the first step and i see my microsoft account name already but when i click to send a test email it's not working it respond me this

从github克隆此示例后,我只需修改一些代码(将我的APIKEY和clientID插入/utils/config.js)

After I clone this example from github i just modify a bit of code (Insert My APIKEY and clientID at /utils/config.js )

module.exports = {
  creds: {
    redirectUrl: 'http://localhost:3000/token',
    clientID: 'd5cec81e-13b3-XXXX-b90f-de0b123feaa4',
    clientSecret: '9G8ay7BhvXXXXXX35JXONhSc',
    identityMetadata: 'https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration',
    allowHttpForRedirectUrl: true, // For development only
    responseType: 'code',
    validateIssuer: false, // For development only
    responseMode: 'query',
    scope: ['User.Read', 'Mail.Send', 'Files.ReadWrite']
  }
};

然后我编译并运行它.就这样

and I compiled and run it . that's all

这是我的日志

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@3.10.10
3 info using node@v6.10.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle nodejs-microsoft-graph-connect@2.0.0prestart: nodejs-microsoft-graph-connect@2.0.0
6 silly lifecycle nodejs-microsoft-graph-connect@2.0.0prestart: no script for prestart, continuing
7 info lifecycle nodejs-microsoft-graph-connect@2.0.0start: nodejs-microsoft-graph-connect@2.0.0
8 verbose lifecycle nodejs-microsoft-graph-connect@2.0.0start: unsafe-perm in lifecycle true
9 verbose lifecycle nodejs-microsoft-graph-connect@2.0.0start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/st4rboy/Desktop/Intern/nodejs-connect-rest-sample-master/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
10 verbose lifecycle nodejs-microsoft-graph-connect@2.0.0start: CWD: /Users/st4rboy/Desktop/Intern/nodejs-connect-rest-sample-master
11 silly lifecycle nodejs-microsoft-graph-connect@2.0.0start: Args: [ '-c', 'mocha ./tests/confTest.js && node ./bin/www' ]
12 silly lifecycle nodejs-microsoft-graph-connect@2.0.0start: Returned: code: 1 signal: null
13 info lifecycle nodejs-microsoft-graph-connect@2.0.0~start: Failed to exec start script
14 verbose stack Error: nodejs-microsoft-graph-connect@2.0.0 start: mocha ./tests/confTest.js && node ./bin/www
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:886:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid nodejs-microsoft-graph-connect@2.0.0
16 verbose cwd /Users/st4rboy/Desktop/Intern/nodejs-connect-rest-sample-master
17 error Darwin 16.6.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 error node v6.10.3
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error nodejs-microsoft-graph-connect@2.0.0 start: mocha ./tests/confTest.js && node ./bin/www
22 error Exit status 1
23 error Failed at the nodejs-microsoft-graph-connect@2.0.0 start script 'mocha ./tests/confTest.js && node ./bin/www'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the nodejs-microsoft-graph-connect package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error mocha ./tests/confTest.js && node ./bin/www
23 error You can get information on how to open an issue for this project with:
23 error npm bugs nodejs-microsoft-graph-connect
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls nodejs-microsoft-graph-connect
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

推荐答案

我刚刚下载并运行了示例,还遇到了一些问题.我无法根据日志告诉您遇到的特定错误,但是这里有一些使示例正常工作的提示.其中一些是样本中的错误,我已通知维护样本的工程师.

I just downloaded and ran the sample and ran into a few issues as well. I can't tell the specific error that you're hitting based on your log, but here's some tips for getting the sample to work. Some of these are bugs in the sample and I've notified our engineers that maintain the samples.

  1. renderError()方法中存在一个错误,该错误导致错误页面无法呈现,这可能是您的浏览器显示空白页面的原因.我建议在sendMail方法周围设置断点以查看实际错误,直到修复错误处理为止.在 Visual Studio代码(轻量级IDE,而不是Visual Studio)中,单击鼠标左键一样简单.行号.
  1. There's a bug in the renderError() method that causes the error page not to render and that might be why your browser is showing an empty page. I recommend setting breakpoints around the sendMail method to see the actual error until the error handling is fixed. In Visual Studio Code (the lightweight IDE, not Visual Studio), it's as easy as clicking to the left of the line numbers.

  1. 单击发送电子邮件"按钮实际上会启动一个过程,以提取用户的个人资料照片,将其上传到OneDrive,并获得一个共享链接以插入到电子邮件正文中.如果这些操作中的任何一个失败,将不会发送电子邮件.我建议在index.js中的prepForEmailMessage()周围设置断点,以查看其中任何一个都不起作用.例如,如果您的用户没有个人资料图片,则该GET请求将产生404,导致无法发送邮件.
  1. Clicking the send email button actually kicks off a process to fetch the user's profile photo, uploads it to OneDrive and gets a sharing link to insert into the email message body. If any of these operations fail, the email won't be sent. I recommend setting breakpoints around prepForEmailMessage() in index.js to see if any of these aren't working. For example, if your user doesn't have a profile picture, that GET request will result in a 404 which causes the mail not to be sent.

这篇关于sendMail函数似乎不适用于Microsoft graph的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆