11件ヒット
[1-11件を表示]
(0.019秒)
検索結果
先頭1件
-
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'
}
==== 文字列以...