Gmail "InternalDateSource" query parameter not working -


i asked question last month, , had no response. isn't google supposed monitoring forum gmail api questions? there place support (even paid?) i'm kind of desperate. anyway...

i using "insert" api add message gmail, , using query parameter internaldatesource=dateheader. gmail seems ignore "date" header in rfc822 data, substituting current date. post url looks this:

https://www.googleapis.com/gmail/v1/users/user@gmail.com/messages?uploadtype=multipart&internaldatesource=dateheader&access_token=xyz 

my uploaded data looks this:

{ "labelids": [ "label_96" ],"raw": "rnjvbto...tdqr_" } 

there no doubt correct "date" header in encoded raw data. (here example):

date: wed, 1 oct 2011 10:47:00 -08:00 

google picks other headers , message data correctly. doing wrong? btw did try adding "payload" , "headers" json in attempt specify date header. no change.

tl;dr

i think formatted date wrong. should be

wed, 1 oct 2011 10:47:00 -0800 

not

wed, 1 oct 2011 10:47:00 -08:00 

this question intrigued me, , got work!

first, created example mail, encoded , made url safe:

btoa(         "date:  thu, 1 jan 1970 01:00:00 -0400\n"         "content-type: text/plain;\n" +         "to: example@gmail.com\n" +         "from: example@gmail.com\n" +         "subject: example subject text\n\n" +          "the actual message text goes here"   ).replace(/\+/g, '-').replace(/\//g, '_'); 

i used own email address instead of example@gmail.com, of course.

which resulted in following base64-encoded data:

rgf0ztogifrodswgmsbkyw4gmtk3mcawmtowmdowmcatmdqwmapdb250zw50lvr5cgu6ihrlehqvcgxhaw47cnrvoiblegftcgxlqgdtywlslmnvbqpmcm9toiblegftcgxlqgdtywlslmnvbqpzdwjqzwn0oibfegftcgxlifn1ymply3qgvgv4daokvghligfjdhvhbcbtzxnzywdlihrlehqgz29lcybozxjl 

then, mimicked request:

post https://www.googleapis.com/gmail/v1/users/me/messages?internaldatesource=dateheader&key={your_api_key}  {  "raw": "rgf0ztogifrodswgmsbkyw4gmtk3mcawmtowmdowmcatmdqwmapdb250zw50lvr5cgu6ihrlehqvcgxhaw47cnrvoiblbxrob2xpbkbnbwfpbc5jb20kznjvbtogzw10ag9saw5az21hawwuy29tcnn1ymply3q6iev4yw1wbgugu3viamvjdcbuzxh0cgpuagugywn0dwfsig1lc3nhz2ugdgv4dcbnb2vzighlcmu=" } 

which resulted in mail on beginning of epoch under "all mail"-label.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -