-
-
Save vicjang/a2d6579ef7bbfc747795 to your computer and use it in GitHub Desktop.
simple script, which finds Notes from iOS app in my Gmail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/imap" | |
require "mail" | |
=begin | |
SAMPLE zpravy | |
Subject: =?utf-8?Q?Kv=C4=9Btin=C3=A1=C5=99stv=C3=AD_D=C4=9Bl=C5=88=C3=A1k?= | |
From: =?utf-8?Q?Ondra_Bene=C5=A1?= <[email protected]> | |
X-Universally-Unique-Identifier: DDC4E35E-7D70-4E97-8167-011B204229D3 | |
Content-Type: text/html; | |
charset=utf-8 | |
X-Uniform-Type-Identifier: com.apple.mail-note | |
Message-Id: <[email protected]> | |
Date: Mon, 25 Jun 2012 17:47:46 +0200 | |
X-Mail-Created-Date: Mon, 25 Jun 2012 17:47:46 +0200 | |
Content-Transfer-Encoding: quoted-printable | |
Mime-Version: 1.0 (1.0) | |
Kv=C4=9Btin=C3=A1=C5=99stv=C3=AD D=C4=9Bl=C5=88=C3=A1k<div><br></div><div>Po= | |
-P=C3=A1 9-17</div><div>So 8-11</div>= | |
=end | |
imap = Net::IMAP.new("imap.gmail.com", 993, true, nil, false) | |
imap.login("steve.jobs", "supersecret") | |
puts "Logged in" | |
imap.select("[Gmail]/All Mail") | |
puts "In folder" | |
imap.search(["All"]).each do |mail| | |
if imap.uid_fetch(mail, 'RFC822') == Array | |
mail = Mail.new imap.uid_fetch(mail, 'RFC822').first.attr['RFC822'] | |
p mail.header["X-Uniform-Type-Identifier"] if mail.header["X-Uniform-Type-Identifier"] == "com.apple.mail-note" | |
end | |
end | |
puts "Search done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment