I would like to read through my all my Gmail emails' headers to find specific information.
I know there is no access through the GmailApp service (well, pretty sure anyway).
Any ideas on how to get the header information with a solution primarily based in Apps Script?
No, email headers are not possible through the Apps Script services. You'll have to go the IMAP or SMTP route for that.
-- UPDATE
You got me curious and looks like you can get the important ones through getRawContent()
and manually parse it.
Here is the code you can try -
function processInbox() {
//get first message in first thread
var message = GmailApp.getInboxThreads(0,1)[0].getMessages()[0];
Logger.log(message.getRawContent());
};
and here is the output from a LinkedIn group message -
From: Google APPS users Group Members <[email protected]>
To: Arun Nagarajan <[email protected]>
Message-ID: <[email protected]>
Subject: [2] discussions, [1] comment and [1] job on LinkedIn
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_35263277_1178500841.1354293878345"
X-LinkedIn-Template: anet_digest_type
X-LinkedIn-Class: GROUPDIGEST
X-LinkedIn-fbl: s-uPmFAdhOYxvH52TwUlkvTF6rOfu4R6CRfjIFaaCOYfXQgGt9OunBRp
------=_Part_35263277_1178500841.1354293878345
Content-Type: multipart/related;
boundary="----=_Part_35263278_821958406.1354293878345"
------=_Part_35263278_821958406.1354293878345
Content-Type: multipart/alternative;
boundary="----=_Part_35263270_1718315066.1354293878331"
------=_Part_35263270_1718315066.1354293878331
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
message here
<snip>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With