<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>NeoCat</author_name>
  <author_url>https://blog.hatena.ne.jp/NeoCat/</author_url>
  <blog_title>Okiraku Programming</blog_title>
  <blog_url>https://neocat.hatenablog.com/</blog_url>
  <categories>
    <anon>ruby</anon>
  </categories>
  <description>Gmailをはじめとする、IMAPのメールサーバ*1から、プッシュ配信されるメールを取得する方法を調べたのでメモ。新規メールを監視してリアルタイムに何らかの処理を実行するといったことが可能になります。使うライブラリは require 'net/imap' まず接続と認証、それから監視したいメールボックス（Gmailなら&quot;INBOX&quot;や特定のラベル*2など）をselectしたのち、IDLEコマンドを発行してイベントが起こるのを待機します。新たなメールが追加されるとEXISTSイベントで新しいメールのIDが通知されるので、imap.idleの中でそれを検知し、idleを抜けます（そうしないとメール…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fneocat.hatenablog.com%2Fentry%2F20140818%2F1408342606&quot; title=&quot; Gmailでプッシュ配信されるメールを取得 - Okiraku Programming&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2014-08-18 15:16:46</published>
  <title> Gmailでプッシュ配信されるメールを取得</title>
  <type>rich</type>
  <url>https://neocat.hatenablog.com/entry/20140818/1408342606</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
