问题描述
限时送ChatGPT账号..我尝试使用 - 试试看 的 Google REST API - Users.messages: send .
有一个必需的参数 - raw
-
采用 RFC 2822 格式和 base64url 编码字符串的整个电子邮件消息.在messages.get 和drafts.get 响应中返回时提供了 format=RAW 参数.
我检查了 RFC 2822 格式,似乎它应该显示为 sample here ,然后我用这个编码器将 base64URL 编码并将其粘贴到 raw 字段/v1/reference/users/messages/send#try-it" rel="noreferrer">尝试 我得到 - 字节字符串的无效值:http://ostermiller/calc/encode.html
.
你能给我提供一个正确的 RFC 2822 格式
及其对应的 base64URL
,它可以在上面的 试试 ?
示例邮件可能如下所示:
发件人:sender@gmail至:receiver@gmail主题:主题文本消息文本在这里
在您的浏览器中打开开发者工具并对其进行 Base64 编码并将所有 +
替换为 -
,将所有 /
替换为 _
,并删除尾随的 =
以使其 URL 安全:
btoa("发件人:sender@gmail\r\n" +"收件人:receiver@gmail\r\n" +"主题:主题文本\r\n\r\n" +消息文本在这里").replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
这将为您提供以下数据:
使用上述字符串作为 rawRnJvbTogc2VuZGVyQGdtYWlsLmNvbQ0KVG86IHJlY2VpdmVyQGdtYWlsLmNvbQ0KU3ViamVjdDogU3ViamVjdCBUZXh0DQoNClRoZHlWlXZIHpZYpdZXIHJlY2VpdmVyQGdtYWlsLmNvbQ0KU3ViamVjdDogU3ViamVjdXI
参数尝试"rel="noreferrer">API Explorer 发送邮件.
I try the use the - try it of Google REST API - Users.messages: send .
There is there a required parameter - raw
-
The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
I checked about RFC 2822 format and seems it should displayed as the sample here , then I encoded it the base64URL with this encoder and paste it the raw
field of the try it and I get - Invalid value for ByteString: http://ostermiller/calc/encode.html
.
Can you provide me a correct RFC 2822 format
and its corresponding base64URL
which it would work in the above try it ?
An example mail could look like this:
From: sender@gmail
To: receiver@gmail
Subject: Subject Text
The message text goes here
Open up the Developer Tools in your browser and Base64 encode it and replace all +
with -
, replace all /
with _
, and remove the trailing =
to make it URL-safe:
btoa(
"From: sender@gmail\r\n" +
"To: receiver@gmail\r\n" +
"Subject: Subject Text\r\n\r\n" +
"The message text goes here"
).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
This will give you the following data:
RnJvbTogc2VuZGVyQGdtYWlsLmNvbQ0KVG86IHJlY2VpdmVyQGdtYWlsLmNvbQ0KU3ViamVjdDogU3ViamVjdCBUZXh0DQoNClRoZSBtZXNzYWdlIHRleHQgZ29lcyBoZXJl
Use this string above as your raw
-parameter in the API Explorer to send the mail.
这篇关于Google REST API - RFC 2822 格式和 base64url 编码字符串中的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论