8件ヒット
[1-8件を表示]
(0.057秒)
検索結果
先頭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 サ......rom@example.com>
To: Dest Address <to@example.net>
Subject: test mail
Date: Sat, 23 Jun 2001 16:26:43 +0900
Message-Id: <unique.message.id.string@yourhost.example.com>
This is a test mail.
EndOfMail
}
==== セッションを終了する
メールを送ったら Net::SMTP#finish......るでしょう。
require 'net/smtp'
# STARTTLSの例
smtp = Net::SMTP.new('smtp.example.com', 25)
# SSLのコンテキストを作成してSSLの設定をし、context に代入しておく
# TLSを常に使うようにする
smtp.enable_starttls(context)
smtp.start() do
# send...