【发布时间】:2018-10-09 07:27:32
【问题描述】:
经过大量研究和修复问题,我到达了github中的以下位置。但我不知道我是否正确安装了 json。出现以下错误:
{
error:
{
errors: [
{
domain: global,
reason: parseError,
message: This API does not support parsing form-encoded input.
}
],
code: 400,
message: This API does not support parsing form-encoded input.
}
}
我将帖子设置如下,更多详情项目在我的github
// scope for send email
GoogleSignIn googleSignIn = new GoogleSignIn(
scopes: <String>[
'https://www.googleapis.com/auth/gmail.send'
],
);
await googleSignIn.signIn().then((data) {
testingEmail(data.email, data.authHeaders);
});
// userId is the email
Future<Null> testingEmail(userId, header) async {
String url = 'https://www.googleapis.com/gmail/v1/users/' + userId + '/messages/send';
final http.Response response = await http.post(
url,
headers: await header,
body: {
'from': userId,
'to': userId,
'subject': 'testing send email',
'text': 'worked!!!'
}
);
}
我做错了什么,无法通过 Google API 发送电子邮件?你能帮我解决这个问题吗?
【问题讨论】:
-
需要将 Content-Type 标头设置为 application/json