diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-01-15 03:34:59 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-01-15 03:34:59 +0000 |
commit | a7d98b7bc323f5915bab6a1984989e60f5686584 (patch) | |
tree | 6d2e04619f8b0a63b0e53cd456415215fc3f170a /doc/net/smtp.rd.ja | |
parent | 0ef2cab2f23d098152b745da3791bf47301b5ed6 (diff) |
aamine
* lib/net/protocol.rb: Protocol#start returns the return value of block.
* lib/net/protocol.rb: set timeout limit by default.
* lib/net/protocol.rb: new methods WriteAdapter#write, puts, print, printf.
* lib/net/protocol.rb: change template method scheme.
* lib/net/http.rb: rename HTTP#get2 to request_get, post2 to request_post ...
* lib/net/pop.rb: POP#auth_only did not work.
* lib/net/smtp.rb: should not resolve HELO domain automatically.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'doc/net/smtp.rd.ja')
-rw-r--r-- | doc/net/smtp.rd.ja | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/doc/net/smtp.rd.ja b/doc/net/smtp.rd.ja index 7b4073ca62..cc87865dc7 100644 --- a/doc/net/smtp.rd.ja +++ b/doc/net/smtp.rd.ja @@ -1,6 +1,6 @@ =begin -= net/smtp.rb version 1.1.37 += net/smtp.rb == このライブラリについて @@ -76,17 +76,25 @@ each メソッドを持ったオブジェクトからならなんでも送ることができます。 } } -=== Hello ドメイン +=== HELO ドメイン -SMTP ではメールを送る側のホストの名前を要求されるのですが、 -ダイヤルアップなどの場合には自分のマシンに正式な名前がない場合が -あります。そのような場合は適宜 SMTP サーバの名前などを与えてやら -ないと配送を拒否されることがあります。SMTP.start あるいは SMTP#start -の引数 helo_domain がそれです。 +SMTP ではメールを送る側のホストの名前 (HELO ドメインと呼ぶ) を要求 +されるのですが、Net::SMTP ではとりあえず localhost.localdomain と +いう名前を送信しています。たいていの SMTP サーバはこの HELO ドメイン +による認証はあまり真面目に行わないので (簡単に偽造できるからです) +問題にならないことが多いのですが、まれにメールセッションを切られる +こともあります。そういうときはとりあえず HELO ドメインを与えてみて +ください。もちろんそれ以外の時も HELO ドメインはちゃんと渡すのが +ベストです。 + +HELO ドメインは SMTP.start/SMTP#start の第三引数 helo_domain に指定 +します。 Net::SMTP.start( 'your.smtp.server', 25, 'mail.from.domain' ) {|smtp| +よくあるダイヤルアップホストの場合、HELO ドメインには ISP のメール +サーバのドメインを使っておけばたいてい通ります。 == class Net::SMTP @@ -96,8 +104,8 @@ SMTP ではメールを送る側のホストの名前を要求されるのですが、 新しい SMTP オブジェクトを生成します。address はSMTPサーバーのFQDNで、 port は接続するポート番号です。ただし、このメソッドではまだ接続はしません。 -: start( address, port = 25, helo_domain = Socket.gethostname, account = nil, password = nil, authtype = nil ) -: start( address, port = 25, helo_domain = Socket.gethostname, account = nil, password = nil, authtype = nil ) {|smtp| .... } +: start( address, port = 25, helo_domain = 'localhost.localdomain', account = nil, password = nil, authtype = nil ) +: start( address, port = 25, helo_domain = 'localhost.localdomain', account = nil, password = nil, authtype = nil ) {|smtp| .... } 以下と同じです。 Net::SMTP.new(address,port).start(helo_domain,account,password,authtype) @@ -161,11 +169,13 @@ SMTP ではメールを送る側のホストの名前を要求されるのですが、 # example Net::SMTP.start( 'your.smtp.server', 25 ) {|smtp| - smtp.ready( 'from@mail.addr', 'dest@mail.addr' ) do |adapter| - adapter.write str1 - adapter.write str2 - adapter.write str3 - end + smtp.ready( 'from@mail.addr', 'dest@mail.addr' ) {|f| + f.puts 'From: aamine@loveruby.net' + f.puts 'To: someone@somedomain.org' + f.puts 'Subject: test mail' + f.puts + f.puts 'This is test mail.' + } } == 発生する例外 |