使用 Groups Migration API 將電子郵件遷移至 Google 網路論壇之前,請先完成 追蹤
- 遷移 電子郵件傳送至該群組的封存。如要進一步瞭解如何列出群組和使用者,請參閱 Directory API。
- 如果電子郵件的寄件者與目標群組的網域相同,請先確認電子郵件寄件者是否存在,再將電子郵件遷移至目標群組的封存資料夾。
- 電子郵件訊息格式必須為
RFC 822 標準定義。
使用
Content-type: message/rfc822
標頭。確認電子郵件訊息的To:
、From:
和Date:
欄位格式正確無誤。 則會在 JSON 資料格式。
將電子郵件遷移至 Google 網路論壇
如要將電子郵件訊息遷移至群組的封存資料,請傳送 POST
HTTP 要求,並加入 Authorization
標頭,然後將 GROUP_EMAIL_ADDRESS
替換為訊息的群組電子郵件地址:
POST https://www.googleapis.com/upload/groups/v1/groups/GROUP_EMAIL_ADDRESS/archive?uploadType=media
要求範例
這個範例會將電子郵件遷移至 samplegroup@googlegroups.com 封存資料夾。Content-Length
大小上限為 25 MB,包括訊息的結構描述、內文和任何附件:
POST https://www.googleapis.com/upload/groups/v1/groups/samplegroup@googlegroups.com/archive?uploadType=media
Host: www.googleapis.com
Content-Type: message/rfc822
Content-Length: BYTES
Authorization: Bearer Auth token
METADATA_BODY
更改下列內容:
BYTES
:電子郵件中的位元組數。AUTH_TOKEN
:Authorization
標頭。METADATA_BODY
:電子郵件的中繼資料、內文和任何附件。以下是 RFC 822 文字格式的電子郵件訊息遷移後,
examplegroup@googlegroups.com 封存。這是NNNN@mail.samplegroup.com
範例的 Message-ID遷移電子郵件的寄件者為 samplesender@example.com,電子郵件為
已遷移至 samplegroup@googlegroups.com 群組的封存檔:
Received: by 10.143.160.15 with HTTP; Mon, 16 Jul 2007 10:12:26 -0700 (PDT) Message-ID: <NNNN@mail.samplegroup.com> Date: Mon, 16 Jul 2007 10:12:26 -0700 From: samplesender@example.com To: samplegroup@googlegroups.com Subject: SUBJECT MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Delivered-To: samplegroup@samplegroup.com This is the body of the migrated email message.
成功的回應會傳回 200
HTTP 狀態碼和遷移狀態。
如要進一步瞭解 responseCode
值,請參閱 Groups Migration API 參考資料。
{ "kind": "groupsMigration#groups", "responseCode": "SUCCESS", }
在 Google 網路論壇介面中查看匯入的訊息
在 Google 網路論壇中,討論串系統會為每位使用者分別儲存讀取/未讀取狀態。使用 Groups Migration API 插入訊息和會話串時,系統會將這些項目視為使用者在 From:
標頭中傳送的內容。這表示除了地址位於 From:
標頭中的使用者以外,所有使用者都會看到未讀訊息。例如:
上一個 JSON 要求範例之後,標題為 SUBJECT
的訊息會顯示為已讀
samplesender@example.com
已登入 Google 網路論壇,但顯示為未讀取
供其他使用者使用