This is a cryptographically signed message in MIME format.

--------------ms000402090802010403030602
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

DOCOMO =E3=81=AE=E3=82=AD=E3=83=A3=E3=83=AA=E3=82=A2=E3=83=A1=E3=83=BC=E3=
=83=AB=E3=81=A7=E5=B1=8A=E3=81=84=E3=81=9F=E3=83=A1=E3=83=BC=E3=83=AB=E3=82=
=92
=E3=83=AA=E3=82=A2=E3=83=AB=E3=82=BF=E3=82=A4=E3=83=A0=E3=81=AB=E9=80=9A=E7=
=9F=A5=E3=81=99=E3=82=8B=E3=81=9F=E3=82=81=E3=81=AE=E3=83=97=E3=83=AD=E3=82=
=B0=E3=83=A9=E3=83=A0=E3=82=92
=E4=BD=9C=E3=82=8D=E3=81=86=E3=81=A8=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E3=
=81=AE=E3=81=A7=E3=81=99=E3=81=8C=E3=81=86=E3=81=BE=E3=81=8F=E8=A1=8C=E3=81=
=8D=E3=81=BE=E3=81=9B=E3=82=93=E3=80=82

=E3=82=A4=E3=83=B3=E3=82=BF=E3=83=BC=E3=83=8D=E3=83=83=E3=83=88=E4=B8=8A=E3=
=81=AE=E3=83=96=E3=83=AD=E3=82=B0=E7=AD=89=E3=81=AE=E6=83=85=E5=A0=B1=E3=81=
=AB=E3=82=88=E3=82=8B=E3=81=A8=E3=80=81
DOCOMO =E3=81=AE=E3=83=A1=E3=83=BC=E3=83=AB=E3=81=A7 IMAP =E3=81=AE IDLE =
=E3=82=92=E4=BD=BF=E3=81=A3=E3=81=A6
=E3=83=97=E3=83=83=E3=82=B7=E3=83=A5=E9=80=81=E4=BF=A1=E3=82=92=E5=AE=9F=E7=
=8F=BE=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E3=81=A8=E3=81=84=E3=81=86=E6=A7=
=98=E3=81=AA=E8=A8=98=E4=BA=8B
=E3=81=8C=E3=81=82=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7=E3=80=81=E4=B8=8B=E8=
=A8=98=E3=81=AE=E3=82=88=E3=81=86=E3=81=AA=E3=83=97=E3=83=AD=E3=82=B0=E3=83=
=A9=E3=83=A0=E3=82=92=E6=9B=B8=E3=81=84=E3=81=9F
=E3=81=AE=E3=81=A7=E3=81=99=E3=81=8C=E3=80=81Net::IMAP#idle =E3=82=92=E5=AE=
=9F=E8=A1=8C=E3=81=97=E3=81=9F=E6=99=82=E7=82=B9=E3=81=A7
=E6=8E=A5=E7=B6=9A=E3=81=8C=E5=88=87=E3=82=8C=E3=81=A6=E3=81=97=E3=81=BE=E3=
=81=86=E3=82=88=E3=81=86=E3=81=AA=E3=81=AE=E3=81=A7=E3=81=99=E3=81=8C=E3=80=
=81
=E3=81=A9=E3=81=AE=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8C=E3=81=B0=E8=
=89=AF=E3=81=84=E3=81=AE=E3=81=A7=E3=81=97=E3=82=87=E3=81=86=E3=81=8B=EF=BC=
=9F

=E5=90=8C=E3=81=98=E3=83=97=E3=83=AD=E3=82=B0=E3=83=A9=E3=83=A0=E3=81=A7 =
gmail =E3=81=A7=E3=81=AF=E6=AD=A3=E3=81=97=E3=81=8F=E5=8B=95=E3=81=84=E3=81=
=A6=E3=81=84=E3=82=8B
=E3=81=93=E3=81=A8=E3=81=AF=E7=A2=BA=E8=AA=8D=E3=81=97=E3=81=BE=E3=81=97=E3=
=81=9F=E3=80=82


=E6=B1=9F=E6=9C=AC


=3D=3D =E5=AE=9F=E8=A1=8C=E7=B5=90=E6=9E=9C =3D=3D

:~/src/ruby/imap ./test_imap2.rb
connected to imap server
["IMAP4REV1", "NAMESPACE", "IDLE", "LITERAL+", "UIDPLUS", "QUOTA", "AUTH=3D=
LOGIN",=20
"ID"]
#<Net::IMAP::Error: connection closed>
connection closed: reconecting...
connected to imap server
["IMAP4REV1", "NAMESPACE", "IDLE", "LITERAL+", "UIDPLUS", "QUOTA", "AUTH=3D=
LOGIN",=20
"ID"]
#<Net::IMAP::Error: connection closed>
connection closed: reconecting...
connected to imap server
["IMAP4REV1", "NAMESPACE", "IDLE", "LITERAL+", "UIDPLUS", "QUOTA", "AUTH=3D=
LOGIN",=20
"ID"]
#<Net::IMAP::Error: connection closed>

=3D=3D =E3=83=97=E3=83=AD=E3=82=B0=E3=83=A9=E3=83=A0 =3D=3D

#!/usr/bin/env ruby
# coding: utf-8
require 'net/imap'
require 'kconv'
require 'time'


imap_user =3D"=E3=83=A6=E3=83=BC=E3=82=B6=E5=90=8D"
imap_passwd =3D "=E3=83=91=E3=82=B9=E3=83=AF=E3=83=BC=E3=83=89"
imap_server =3D 'imap.spmode.ne.jp'

#imap_user =3D"=E3=83=A6=E3=83=BC=E3=82=B6=E5=90=8D"
#imap_passwd =3D "=E3=83=91=E3=82=B9=E3=83=AF=E3=83=BC=E3=83=89"
#imap_server =3D 'imap.gmail.com'


attr_name =3D 'BODY[HEADER.FIELDS (SUBJECT)]'
attr_addr =3D 'BODY[HEADER.FIELDS (FROM)]'

last_id =3D -1
while true
   begin
     unless $imap
       $imap =3D Net::IMAP.new(imap_server, 993, true)
       $imap.login(imap_user, imap_passwd)
       $imap.select('INBOX')
       puts "connected to imap server"
     end
     capabilities =3D $imap.capability
     p capabilities
     $imap.idle do |resp|
       if resp.name =3D=3D "EXISTS"
         print "New Mail Arrived\n"
         last_id =3D resp.data
         $imap.idle_done
       else
         p resp
       end
     end

   rescue Net::IMAP::Error =3D> e
     p e
     if e.inspect.include? "connection closed"
       puts "connection closed: reconecting..."
       $imap =3D nil
     else
       raise
     end
   end

   next unless $imap

   msgs =3D $imap.fetch((last_id..-1), [attr_name, attr_addr])
   msgs.each do |msg|
     subject =3D msg.attr[attr_name].toutf8.strip
     from =3D msg.attr[attr_addr].toutf8.strip
     print "#{from} #{subject}\n"
   end

end

=3D=3D =E5=AE=9F=E8=A1=8C=E7=92=B0=E5=A2=83 =3D=3D

% lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial
%  ruby --version
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]


--------------ms000402090802010403030602
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCC
CyswggU9MIIEJaADAgECAhBaNO6Dbr/4aIpiCPZMsf9DMA0GCSqGSIb3DQEBCwUAMIGXMQsw
CQYDVQQGEwJHQjEbMBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxm
b3JkMRowGAYDVQQKExFDT01PRE8gQ0EgTGltaXRlZDE9MDsGA1UEAxM0Q09NT0RPIFJTQSBD
bGllbnQgQXV0aGVudGljYXRpb24gYW5kIFNlY3VyZSBFbWFpbCBDQTAeFw0xNzA4MDMwMDAw
MDBaFw0xODA4MDMyMzU5NTlaMCoxKDAmBgkqhkiG9w0BCQEWGWVtb3RvLm1hc2FoaWtvQG5p
ZnMuYWMuanAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC1EyMwNbS+rlqX6xYl
nVNMt325FtYSwFHTMzy0lKPHoM6u/9cYeDpPa8V9FGeV2QOr8DNMj3rIiSo15S0mZsp7VKO3
ubN6iij/9aWMyW6sfbdFXJKSCdS90rRrbCe/dLRFdHiIDVCDuFC4dpWezET0fCLyMAkLx15I
dUy5v/tTybf7WW2wDTPNv+qDXJv0mpxhp9fpTVSQeirrVo20oGTMccEXF8HP+k0W8DCzFU0V
9raP9EpA9iut94ngxomDnkl5z2D9S3aQ5E2+EaV31vWnBTupCJazhENW/oQqt/gsxO7p4hW1
UudH/XwSnQvE5u5ys8VerTiWRNI6+nebf5P3AgMBAAGjggHvMIIB6zAfBgNVHSMEGDAWgBSC
r2yM+MX+lmF86B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