mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
285 lines
7.5 KiB
Text
285 lines
7.5 KiB
Text
|
=begin
|
|||
|
|
|||
|
= net/pop.rb version 1.2.3
|
|||
|
|
|||
|
== <20><><EFBFBD>Υ饤<CEA5>֥<EFBFBD><D6A5><EFBFBD><EFBFBD>ˤĤ<CBA4><C4A4><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뤿<EFBFBD><EFBFBD><EFBFBD>Υץ<EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD><EFBFBD> POP3 (Post Office Protocol version 3) <20><>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>饤<EFBFBD>֥<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><EFBFBD><EFBFBD>POP3 <20>μ<EFBFBD><CEBC><EFBFBD><EFBFBD><EFBFBD> [RFC1939]
|
|||
|
((<URL:http://www.ietf.org/rfc/rfc1939.txt>)) <20>˴𤤤Ƥ<F0A4A4A4><C6A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
== <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
=== <20><EFBFBD><E1A1BC><EFBFBD>μ<EFBFBD><CEBC><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥե<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 'inbox/1' 'inbox/2'... <20>˽<CBBD><F1A4ADA4>ߡ<EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>о夫<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ä<EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
pop3.server.address <20><>Ŭ<EFBFBD><C5AC><EFBFBD>ɤߤ<C9A4><DFA4><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
require 'net/pop'
|
|||
|
|
|||
|
Net::POP3.start( 'pop3.server.address', 110,
|
|||
|
'YourAccount', 'YourPassword' ) {|pop|
|
|||
|
if pop.mails.empty? then
|
|||
|
puts 'no mail.'
|
|||
|
else
|
|||
|
i = 0
|
|||
|
pop.each_mail do |m| # or "pop.mails.each ..."
|
|||
|
File.open( 'inbox/' + i.to_s, 'w' ) {|f|
|
|||
|
f.write m.pop
|
|||
|
}
|
|||
|
m.delete
|
|||
|
i += 1
|
|||
|
end
|
|||
|
end
|
|||
|
puts "#{pop.mails.size} mails popped."
|
|||
|
}
|
|||
|
|
|||
|
=== û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD>ʲ<EFBFBD><EFBFBD><EFBFBD>ư<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD><EFBFBD><EFBFBD>ǥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɤ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
require 'net/pop'
|
|||
|
Net::POP3.start( 'pop3.server.address', 110,
|
|||
|
'YourAccount', 'YourPassword' ) {|pop|
|
|||
|
if pop.mails.empty? then
|
|||
|
puts 'no mail.'
|
|||
|
else
|
|||
|
i = 0
|
|||
|
pop.delete_all do |m|
|
|||
|
File.open( 'inbox/' + i.to_s, 'w' ) {|f|
|
|||
|
f.write m.pop
|
|||
|
}
|
|||
|
i += 1
|
|||
|
end
|
|||
|
end
|
|||
|
}
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>饹<EFBFBD><EFBFBD>åɤ<EFBFBD> POP3.delete_all <20><><EFBFBD>Ȥ<EFBFBD><C8A4>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ʤ<EFBFBD><CAA4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
require 'net/pop'
|
|||
|
i = 0
|
|||
|
Net::POP3.delete_all( 'pop3.server.address', 110,
|
|||
|
'YourAccount', 'YourPassword' ) do |m|
|
|||
|
File.open( 'inbox/' + i.to_s, 'w' ) {|f|
|
|||
|
f.write m.pop
|
|||
|
}
|
|||
|
i += 1
|
|||
|
end
|
|||
|
|
|||
|
=== <20>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD>ܽ<EFBFBD><DCBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤǤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD> m.pop <20><><EFBFBD><EFBFBD>ʬ<EFBFBD>ǥ<C7A5><E1A1BC><EFBFBD><EFBFBD><EFBFBD>ҤȤĤ<C8A4>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȤäƤ<EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><EFBFBD><EFBFBD> 3MB <20><><EFBFBD>餤<EFBFBD><E9A4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʥ<CAA5><E1A1BC><EFBFBD>ξ<EFBFBD><CEBE><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǤϤޤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>礬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Τ褦<EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϰʲ<EFBFBD><EFBFBD>Τ褦<EFBFBD><EFBFBD> m.pop
|
|||
|
<EFBFBD><EFBFBD> File <20><><EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD>Ϳ<EFBFBD><CDBF><EFBFBD><EFBFBD><EFBFBD>꤬<EFBFBD>Ȥ<EFBFBD><C8A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
require 'net/pop'
|
|||
|
Net::POP3.delete_all( 'pop3.server.address', 110,
|
|||
|
'YourAccount', 'YourPassword' ) do |m|
|
|||
|
File.open( 'inbox', 'w' ) {|f|
|
|||
|
m.pop f ####
|
|||
|
}
|
|||
|
end
|
|||
|
|
|||
|
=== APOP
|
|||
|
|
|||
|
APOP ǧ<>ڤ<EFBFBD><DAA4>Ȥ<EFBFBD><C8A4>ˤ<EFBFBD>
|
|||
|
(1) POP3 <20><><EFBFBD>饹<EFBFBD>Τ<EFBFBD><CEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> APOP <20><><EFBFBD>饹<EFBFBD><E9A5B9><EFBFBD>Ȥ<EFBFBD>
|
|||
|
(2) POP3.start <20><><EFBFBD><EFBFBD><EFBFBD>ް<EFBFBD><DEB0><EFBFBD><EFBFBD><EFBFBD> true <20><><EFBFBD>Ϥ<EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
# (1)
|
|||
|
require 'net/pop'
|
|||
|
Net::APOP.start( 'apop.server.address', 110,
|
|||
|
'YourAccount', 'YourPassword' ) {|pop|
|
|||
|
# Rest code is same.
|
|||
|
}
|
|||
|
|
|||
|
# (2)
|
|||
|
require 'net/pop'
|
|||
|
Net::POP3.start( 'apop.server.address', 110,
|
|||
|
'YourAccount', 'YourPassword',
|
|||
|
true ####
|
|||
|
) {|pop|
|
|||
|
# Rest code is same.
|
|||
|
}
|
|||
|
|
|||
|
== Net::POP3 class
|
|||
|
|
|||
|
=== <20><><EFBFBD>饹<EFBFBD><EFBFBD>å<EFBFBD>
|
|||
|
|
|||
|
: new( address = 'localhost', port = 110, apop = false )
|
|||
|
Net::POP3 <20><><EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>³<EFBFBD>Ϥ<EFBFBD><CFA4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
apop <20><><EFBFBD><EFBFBD><EFBFBD>ΤȤ<CEA4><C8A4><EFBFBD> APOP ǧ<>ڤ<EFBFBD><DAA4>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
: start( address = 'localhost', port = 110, account, password )
|
|||
|
: start( address = 'localhost', port = 110, account, password ) {|pop| .... }
|
|||
|
address <20><> port <20>֥ݡ<D6A5><DDA1>Ȥ<EFBFBD><C8A4><EFBFBD>³<EFBFBD><C2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> account <20>ѥ<EFBFBD><D1A5><EFBFBD><EFA1BC>
|
|||
|
password <20><> POP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<F3A4B7A4><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> port <20><> nil <20><><EFBFBD>Ϥ<EFBFBD><CFA4><EFBFBD>
|
|||
|
POP3 <20>Υǥե<C7A5><D5A5><EFBFBD><EFBFBD>ȥݡ<C8A5><DDA1><EFBFBD>(110)<29><><EFBFBD>Ȥ<EFBFBD><C8A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
Net::POP3.start( addr, port, account, password ) do |pop|
|
|||
|
pop.each_mail do |m|
|
|||
|
file.write m.pop
|
|||
|
m.delete
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
: foreach( address = 'localhost', port = 110, account, password ) {|mail| .... }
|
|||
|
POP <20><><EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F2B3ABA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>о<EFBFBD><D0BE>Τ<EFBFBD><CEA4>٤ƤΥ<CEA5><E1A1BC><EFBFBD><EFBFBD><EFBFBD>Ф<EFBFBD><D0A4>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
<20>ʲ<EFBFBD><CAB2><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>
|
|||
|
|
|||
|
Net::POP3.start( address, port, account, password ) {|pop|
|
|||
|
pop.each_mail do |m|
|
|||
|
yield m
|
|||
|
end
|
|||
|
}
|
|||
|
|
|||
|
# example
|
|||
|
Net::POP3.foreach( 'your.pop.server', 110,
|
|||
|
'YourAccount', 'YourPassword' ) do |m|
|
|||
|
file.write m.pop
|
|||
|
m.delete if $DELETE
|
|||
|
end
|
|||
|
|
|||
|
: delete_all( address = 'localhost', port = 110, account, password )
|
|||
|
: delete_all( address = 'localhost', port = 110, account, password ) {|mail| .... }
|
|||
|
POP <20><><EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F2B3ABA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>о<EFBFBD><D0BE>Υ<CEA5><E1A1BC><EFBFBD>٤ƺ<D9A4><C6BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
<20>֥<EFBFBD><D6A5>å<EFBFBD><C3A5><EFBFBD>Ϳ<EFBFBD><CDBF><EFBFBD><EFBFBD><EFBFBD>줿<EFBFBD><ECA4BF><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˥֥<CBA5><D6A5>å<EFBFBD><C3A5>ˤ<EFBFBD><CBA4>Υ<CEA5><E1A1BC><EFBFBD><EFBFBD>
|
|||
|
<20>Ϥ<EFBFBD><CFA4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD>ʲ<EFBFBD><CAB2><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>
|
|||
|
|
|||
|
# example
|
|||
|
Net::POP3.delete_all( addr, nil, 'YourAccount', 'YourPassword' ) do |m|
|
|||
|
m.pop file
|
|||
|
end
|
|||
|
|
|||
|
: auth_only( address = 'localhost', port = 110, account, password )
|
|||
|
POP <20><><EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǧ<EFBFBD>ڤ<EFBFBD><DAA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥä<D4A4><C3A4><EFBFBD>³<EFBFBD><C2B3><EFBFBD>ڤ<EFBFBD><DAA4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
POP before SMTP <20><><EFBFBD>ѤǤ<D1A4><C7A4><EFBFBD>
|
|||
|
|
|||
|
# example
|
|||
|
pop = Net::POP3.auth_only( 'your.pop3.server',
|
|||
|
nil, # using default (110)
|
|||
|
'YourAccount',
|
|||
|
'YourPassword' )
|
|||
|
|
|||
|
=== <20><EFBFBD>å<EFBFBD>
|
|||
|
|
|||
|
: start( account, password )
|
|||
|
: start( account, password ) {|pop| .... }
|
|||
|
<20><><EFBFBD>⡼<EFBFBD>ȥۥ<C8A5><DBA5>ȤȤ<C8A4><C8A4><EFBFBD>³<EFBFBD>Ϥ<F2B3ABBB><CFA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD> account<6E><74>
|
|||
|
<20>ѥ<EFBFBD><D1A5><EFBFBD>ɤ<EFBFBD> password <20><><EFBFBD>Ȥä<C8A4> POP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<F3A4B7A4><DEA4><EFBFBD>
|
|||
|
|
|||
|
: active?
|
|||
|
POP3 <20><><EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><F3A4ACB3>Ϥ<EFBFBD><CFA4><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD>鿿<EFBFBD><E9BFBF>
|
|||
|
|
|||
|
: address
|
|||
|
<20><>³<EFBFBD><C2B3><EFBFBD>륢<EFBFBD>ɥ쥹
|
|||
|
|
|||
|
: port
|
|||
|
<20><>³<EFBFBD><C2B3><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD><EFBFBD>ֹ<EFBFBD>
|
|||
|
|
|||
|
: open_timeout
|
|||
|
: open_timeout=(n)
|
|||
|
<20><>³<EFBFBD><C2B3><EFBFBD><EFBFBD><EFBFBD>Ԥĺ<D4A4><C4BA><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD>äƤ⥳<C6A4>ͥ<EFBFBD><CDA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㳰 TimeoutError <20><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
: read_timeout
|
|||
|
: read_timeout=(n)
|
|||
|
<20>ɤߤ<C9A4><DFA4><EFBFBD> (read(1) <20><><EFBFBD><EFBFBD>) <20>ǥ֥<C7A5><D6A5>å<EFBFBD><C3A5><EFBFBD><EFBFBD>Ƥ褤<C6A4><E8A4A4><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD>äƤ<C3A4><C6A4>ɤߤ<C9A4><DFA4><EFBFBD><EFBFBD>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㳰 TimeoutError <20><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
: finish
|
|||
|
POP3 <20><><EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><F3B3ABBB><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4>Υ<CEA5>åɤ<C3A5>
|
|||
|
<20>ƤФ줿<D0A4><ECA4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㳰 IOError <20><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
: mails
|
|||
|
Net::POPMail <20><><EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F2A4ABA4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϥ<EFBFBD><CFA5>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϥ<F2B3ABBB><CFA4><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4>˼<EFBFBD>ưŪ<C6B0>˹<EFBFBD><CBB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
: each_mail {|popmail| .... }
|
|||
|
: each {|popmail| .... }
|
|||
|
pop3.mails.each <20><>Ʊ<EFBFBD><C6B1><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>
|
|||
|
|
|||
|
: delete_all
|
|||
|
: delete_all {|popmail| .... }
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD>о<EFBFBD><D0BE>Υ<CEA5><E1A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾõ<C3B5>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
<20>֥<EFBFBD><D6A5>å<EFBFBD><C3A5><EFBFBD>Ϳ<EFBFBD><CDBF><EFBFBD><EFBFBD><EFBFBD>줿<EFBFBD>Ȥ<EFBFBD><C8A4>Ͼõ<C3B5><EEA4B9><EFBFBD><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD> POPMail <20><><EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD>
|
|||
|
<20>֥<EFBFBD><D6A5>å<EFBFBD><C3A5><EFBFBD><EFBFBD>Ϥ<EFBFBD><CFA4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
# example
|
|||
|
n = 1
|
|||
|
pop.delete_all do |m|
|
|||
|
File.open("inbox/#{n}") {|f| f.write m.pop }
|
|||
|
n += 1
|
|||
|
end
|
|||
|
|
|||
|
: auth_only( account, password )
|
|||
|
POP <20><><EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǧ<EFBFBD>ڤ<EFBFBD><DAA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥä<D4A4><C3A4><EFBFBD>³<EFBFBD><C2B3><EFBFBD>ڤ<EFBFBD><DAA4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
POP before SMTP <20><><EFBFBD>ѤǤ<D1A4><C7A4><EFBFBD>
|
|||
|
# example
|
|||
|
pop = Net::POP3.new( 'your.pop3.server' )
|
|||
|
pop.auth_only 'YourAccount', 'YourPassword'
|
|||
|
|
|||
|
: reset
|
|||
|
<20><><EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꥻ<EFBFBD>åȤ<C3A5><C8A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
<20><><EFBFBD><EFBFBD>Ū<EFBFBD>ˤ<EFBFBD> POPMail#delete <20>Ǿä<C7BE><C3A4><EFBFBD><EFBFBD><EFBFBD>뤬<EFBFBD><EBA4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>褷<EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
(POP3 <20>Ǥϥ<CFA5><E1A1BC><EFBFBD><EFBFBD><EFBFBD>Ĥ<EFBFBD><C4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>褹<EFBFBD><E8A4B9><EFBFBD><EFBFBD>ˡ<EFBFBD>Ϥ<EFBFBD><CFA4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>)
|
|||
|
|
|||
|
== Net::APOP
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>Υ<EFBFBD><EFBFBD>饹<EFBFBD>ǤϿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>åɤ<EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
ǧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> APOP <20><><EFBFBD>Ѥ<EFBFBD><D1A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>
|
|||
|
|
|||
|
=== <20><><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>饹
|
|||
|
Net::POP3
|
|||
|
|
|||
|
== Net::POPMail
|
|||
|
|
|||
|
POP <20><><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>Υ<CEA5><E1A1BC><EFBFBD><EFBFBD><EFBFBD>̤<EFBFBD><CCA4><EFBFBD><EFBFBD><EFBFBD>Ū<EFBFBD><C5AA>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD>륯<EFBFBD>饹<EFBFBD><E9A5B9>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD>Ȥ<EFBFBD><EFBFBD>ä<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD><EFBFBD>벽<EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
=== <20><EFBFBD>å<EFBFBD>
|
|||
|
|
|||
|
: pop( dest = '' )
|
|||
|
<20><EFBFBD><E1A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> dest <20><> << <20><EFBFBD>åɤ<C3A5><C9A4>Ȥäƽ<C6BD><F1A4ADA4>ߤޤ<DFA4><DEA4><EFBFBD>
|
|||
|
dest <20><><EFBFBD>֤<EFBFBD><D6A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
# example
|
|||
|
allmails = nil
|
|||
|
POP3.start( 'your.pop3.server', 110,
|
|||
|
'YourAccount, 'YourPassword' ) do |pop|
|
|||
|
allmails = pop.mails.collect {|popmail| popmail.pop }
|
|||
|
end
|
|||
|
|
|||
|
: pop {|str| .... }
|
|||
|
<20><EFBFBD><E1A1BC><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F2BEAFA4>Ť<EFBFBD><C5A4>ɤߤ<C9A4><DFA4>ߡ<EFBFBD><DFA1>缡<EFBFBD>֥<EFBFBD><D6A5>å<EFBFBD><C3A5><EFBFBD>Ϳ<EFBFBD><CDBF><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
# example
|
|||
|
POP3.start( 'localhost', 110 ) {|pop3|
|
|||
|
pop3.each_mail do |m|
|
|||
|
m.pop do |str|
|
|||
|
# do anything
|
|||
|
end
|
|||
|
end
|
|||
|
}
|
|||
|
|
|||
|
: header
|
|||
|
<20>إå<D8A5><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
: top( lines )
|
|||
|
<20><EFBFBD><E1A1BC><EFBFBD>إå<D8A5><C3A5><EFBFBD> lines <20>Ԥ֤<D4A4><D6A4><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
: delete
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD>о夫<D0BE><E5A4AB><EFBFBD><EFBFBD><E1A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
: size
|
|||
|
<20><EFBFBD><E1A1BC><EFBFBD>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD><EFBFBD> (ñ<>̤ϥХ<CFA5><D0A5><EFBFBD>) <20><EFBFBD><F2A4ABA4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
|||
|
|
|||
|
: deleted?
|
|||
|
<20><EFBFBD>뤬<EFBFBD><EBA4AC><EFBFBD><EFBFBD><EFBFBD>о<EFBFBD><D0BE>Ǿõ<C3B5><EEA4B5><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<C3B5>Ƥ<EFBFBD><C6A4>ޤä<DEA4><C3A4><EFBFBD>
|
|||
|
POP3#reset <20><><EFBFBD>Ȥ<EFBFBD><C8A4>ʳ<EFBFBD><CAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>褹<EFBFBD><E8A4B9><EFBFBD><EFBFBD>ˡ<EFBFBD>Ϥ<EFBFBD><CFA4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
=end
|