るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.019秒)
トップページ > クエリ:GC[x] > クエリ:close[x] > クエリ:net/smtp[x]

別のキーワード

  1. cgi close
  2. _builtin close
  3. cgi/session close
  4. zlib close
  5. logger close

検索結果

net/smtp (38078.0)

メールを送信するためのプロトコル SMTP (Simple Mail Transfer Protocol) を扱うライブラリです。

...す。
ブロックを使うと File.open と同じように終端処理を自動的にやってくれる
のでおすすめです。

require 'net/smtp'
Net::SMTP.start( 'smtp.example.com', 25 ) {|smtp|
# use smtp object only in this block
}

smtp-server.example.com は適切な SMTP サ...
...TP#finish を呼んで
セッションを終了しなければいけません。
File のように GC 時に勝手に close されることもありません。

# using SMTP#finish
require 'net/smtp'
smtp = Net::SMTP.start('smtp.example.com', 25)
smtp.send_message mail_string, 'from@example...
...で便利です。
可能な限りブロック付きの start を使うのがよいでしょう。

# using block form of SMTP.start
require 'net/smtp'
Net::SMTP.start('smtp.example.com', 25) {|smtp|
smtp.send_message mail_string, 'from@example.com', 'to@example.net'
}

==== 文字列以...