別のキーワード
検索結果
先頭1件
-
net
/ smtp (38084.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......ているのに STARTTLS を使用したくない場合は Net::SMTP#disable_starttls を使用します。
require 'net/smtp'
# STARTTLSを使用したくない例
smtp = Net::SMTP.new('smtp.example.com', 25)
smtp.disable_starttls
smtp.start do
# send messages ...
end
デフォル...