Reputation: 5771
I'm trying to import messages from imap to Gmail via Gmail API v1. If I use the API call for insert, I can specify internalDateSource to dateHeader. With that setting the message will display the original sent date in Gmail, instead of the import date.
If I use the Gmail API Upload method, I don't see any option to specify the internalDateSource in the multipart message header. So Gmail will use the latest receive header, which is the import.
Received: from 661831859263-hlgnfsakj37rged896gvl0mitub85lii.apps.googleusercontent.com
named unknown
by gmailapi.google.com
with HTTPREST;
Wed, 4 Mar 2015 00:01:04 -0800
Any ideas how to display the original delivery or sent date in Gmail when uploading a message via upload request?
Upvotes: 0
Views: 342
Reputation: 13528
internalDateSource
should be set as part of the URI, not a header:
https://www.googleapis.com/upload/gmail/v1/users/<userId>/messages?internalDateSource=dateHeader
also, be aware that messages.insert() does not de-duplicate mail nor does it do automatic threading. For migrating mail from another system, messages.import() is probably the better choice.
It's definitely worth reading through the Migrating from the Email Migration API page for some pointers.
Upvotes: 2