Vb.Net Gmail API 发送带有附件的邮件 > 5Mb



在 Gmail API 文档中,我读到当发送大于 5mb 的消息时,我必须在"/upload/gmail/v1/users/userId/messages/send"发出 HTTP 请求,但我找不到任何如何使用 .net 中的客户端库实现这一点的示例

网站上的所有示例都引用了"消息。发送"函数,该函数将原始消息和用户 ID 作为参数,但我看到还有另一个重载,它也需要上传的内容流及其内容类型。

问题是我不知道如何正确称呼它。

有人成功实现它吗?

谢谢你的回答

西 蒙

Simone,这意味着您使用简单的上传:

uploadType=media. For quick transfer of smaller files, for example, 5 MB or less.

必须使用分段上传断点续传 (https://developers.google.com/gmail/api/guides/uploads)

您可以在 https://www.googleapis.com/gmail/v1/users/me/messages/send?access_token=your_access_token&uploadType=multipart 上发送带有有效负载的 post 查询(如果使用 CURL,请参阅CURLOPT_POSTFIELDS)。有效负载必须包含 json 编码的消息。例如,此消息的结构:

$message = [
            'message' => [
                'raw'      => str_replace(['+', '/'], ['-', '_'], base64_encode($mimeString)),
                'threadId' => $yourThreadId
            ]
        ];

变量$mimeString必须包含正确的 MIME 字符串

最新更新