mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
aamine
* lib/net/pop.rb: new method Net::POP3.APOP * lib/net/http.rb: set default Content-Type to x-www-form-urlencoded (causes warning) * lib/net/protocol.rb: remove Net::NetPrivate module. * lib/net/smtp.rb: ditto. * lib/net/pop.rb: ditto. * lib/net/http.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d8c75ddad3
commit
39c0252e04
8 changed files with 156 additions and 133 deletions
|
@ -1,6 +1,6 @@
|
|||
=begin
|
||||
|
||||
= net/http.rb version 1.2.3
|
||||
= net/http.rb
|
||||
|
||||
== このライブラリについて
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
=begin
|
||||
|
||||
= net/pop.rb version 1.2.3
|
||||
= net/pop.rb
|
||||
|
||||
== このライブラリについて
|
||||
|
||||
|
@ -120,26 +120,20 @@ POP3#delete_all
|
|||
|
||||
=== APOP
|
||||
|
||||
APOP 認証を使うには
|
||||
(1) POP3 クラスのかわりに APOP クラスを使う
|
||||
(2) POP3.start の第五引数に true を渡す
|
||||
の二通りの方法があります。
|
||||
Net::POP3 クラスのかわりに Net::APOP クラスを使うと、認証時に APOP を
|
||||
使うようになります。また動的にノーマル POP と APOP を選択するには、
|
||||
以下のように Net::POP3.APOP() メソッドを使うのが便利です。
|
||||
|
||||
# (1)
|
||||
require 'net/pop'
|
||||
Net::APOP.start( 'apop.server.address', 110,
|
||||
'YourAccount', 'YourPassword' ) {|pop|
|
||||
|
||||
# use APOP authentication if $isapop == true
|
||||
pop = Net::POP3.APOP($isapop).new( 'apop.server.address', 110 )
|
||||
pop.start( 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.
|
||||
}
|
||||
この方法はクラス自体を変えるので、クラスメソッドの start や foreach、
|
||||
delete_all、auth_only なども APOP とともに使えます。
|
||||
|
||||
== Net::POP3 class
|
||||
|
||||
|
@ -162,6 +156,18 @@ APOP ǧ
|
|||
end
|
||||
}
|
||||
|
||||
: APOP( is_apop )
|
||||
bool が真なら Net::APOP クラス、偽なら Net::POP3 クラスを返します。
|
||||
以下の例のように使ってください。
|
||||
|
||||
# example 1
|
||||
pop = Net::POP3::APOP($isapop).new( addr, port )
|
||||
|
||||
# example 2
|
||||
Net::POP3::APOP($isapop).start( addr, port ) {|pop|
|
||||
....
|
||||
}
|
||||
|
||||
: foreach( address, port = 110, account, password ) {|mail| .... }
|
||||
POP セッションを開き、サーバ上のすべてのメールに対して繰り返します。
|
||||
以下と同じです。
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
=begin
|
||||
|
||||
= net/smtp.rb version 1.2.3
|
||||
= net/smtp.rb
|
||||
|
||||
== このライブラリについて
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue