別のキーワード
種類
- インスタンスメソッド (57)
- 特異メソッド (44)
- 文書 (12)
- ライブラリ (4)
クラス
- Array (21)
-
Net
:: SMTP (32) - Socket (12)
- String (12)
-
URI
:: Generic (24)
キーワード
- gethostname (12)
- hostname= (12)
-
net
/ smtp (4) - pack (21)
- pack テンプレート文字列 (12)
- start (32)
- unpack (12)
検索結果
先頭5件
- URI
:: Generic # hostname -> String | nil - URI
:: Generic # hostname=(s) - Socket
. gethostname -> String - Net
:: SMTP . start(address , port = Net :: SMTP . default _ port , tls _ verify: true , tls _ hostname: nil , helo: & # 39;localhost& # 39; , user: nil , password: nil , authtype: DEFAULT _ AUTH _ TYPE) -> Net :: SMTP - Net
:: SMTP . start(address , port = Net :: SMTP . default _ port , tls _ verify: true , tls _ hostname: nil , helo: & # 39;localhost& # 39; , user: nil , password: nil , authtype: DEFAULT _ AUTH _ TYPE) {|smtp| . . . } -> object
-
URI
:: Generic # hostname -> String | nil (18129.0) -
自身の hostname を文字列で返します。また、URI::Generic#host が設 定されていない場合は nil を返します。
...自身の hostname を文字列で返します。また、URI::Generic#host が設
定されていない場合は nil を返します。
このメソッドは URI::Generic#host に IPv6 アドレスが設定されていた
場合はブラケットを削除した文字列を返しますがそれ以......外は同じ文字列を返し
ます。
require 'uri'
u = URI("http://[::1]/bar")
p u.hostname # => "::1"
p u.host # => "[::1]"... -
URI
:: Generic # hostname=(s) (6135.0) -
自身の hostname を設定します。
...自身の hostname を設定します。
このメソッドは引数に IPv6 アドレスを設定した場合は
URI::Generic#host にブラケットを追加した文字列を設定しますがそれ
以外は同じ処理を行います。
require 'uri'
u = URI("http://foo/bar")
p u.to_s......# => "http://foo/bar"
u.hostname = "::1"
p u.to_s # => "http://[::1]/bar"
@param s 自身の hostname を表す文字列を指定します。
@raise URI::InvalidComponentError 不正な引数 s に対して発生します。
@raise URI::InvalidURIError host... -
Socket
. gethostname -> String (6106.0) -
システムの標準のホスト名を取得します。
...の標準のホスト名を取得します。
ホストの別名やアドレスなど他の情報を得るには
Socket.getaddrinfo を使ってください。
ただし、これは不可能な場合もあります。
例:
require 'socket'
p Socket.gethostname #=> "helium.ruby-lang.org"... -
Net
:: SMTP . start(address , port = Net :: SMTP . default _ port , tls _ verify: true , tls _ hostname: nil , helo: & # 39;localhost& # 39; , user: nil , password: nil , authtype: DEFAULT _ AUTH _ TYPE) -> Net :: SMTP (120.0) -
新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
...新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
以下と同じです。
require 'net/smtp'
Net::SMTP.new(address, port).start(helo: helo, user: user, password: password, authtype: authtype)
このメソッドにブロックを与......証を行います。
authtype は使用する認証のタイプで、
シンボルで :plain, :login, :cram_md5 を指定します。
Example:
require 'net/smtp'
Net::SMTP.start('smtp.example.com') {|smtp|
smtp.send_message mail_string, 'from@example.jp', 'to@example.jp'
}
@param addr......します
@param port ポート番号、デフォルトは 25 です
@param tls_verify サーバー証明書を検証するか否か
@param tls_hostname サーバー証明書のホスト名
@param helo HELO で名乗るドメイン名です
@param user 認証で使うアカウント名
@param passwo... -
Net
:: SMTP . start(address , port = Net :: SMTP . default _ port , tls _ verify: true , tls _ hostname: nil , helo: & # 39;localhost& # 39; , user: nil , password: nil , authtype: DEFAULT _ AUTH _ TYPE) {|smtp| . . . } -> object (120.0) -
新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
...新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
以下と同じです。
require 'net/smtp'
Net::SMTP.new(address, port).start(helo: helo, user: user, password: password, authtype: authtype)
このメソッドにブロックを与......証を行います。
authtype は使用する認証のタイプで、
シンボルで :plain, :login, :cram_md5 を指定します。
Example:
require 'net/smtp'
Net::SMTP.start('smtp.example.com') {|smtp|
smtp.send_message mail_string, 'from@example.jp', 'to@example.jp'
}
@param addr......します
@param port ポート番号、デフォルトは 25 です
@param tls_verify サーバー証明書を検証するか否か
@param tls_hostname サーバー証明書のホスト名
@param helo HELO で名乗るドメイン名です
@param user 認証で使うアカウント名
@param passwo... -
net
/ smtp (78.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 は適切......してくれているはずです。
セッションが開いたらあとは Net::SMTP#send_message
でメールを流しこむだけです。
require 'net/smtp'
Net::SMTP.start('smtp.example.com', 25) {|smtp|
smtp.send_message(<<-EndOfMail, 'from@example.com', 'to@example.net')
From:......(IPアドレス等)で接続したい場合は、+tls_hostname+ で証明書のホスト名を指定します。
require 'net/smtp'
# 証明書と異なるホスト名で接続する場合
Net::SMTP.start('192.168.1.1', 25, tls_hostname: 'smtp.example.com') do |smtp|
# send messages ...... -
Net
:: SMTP . start(address , port = Net :: SMTP . default _ port , helo = & # 39;localhost& # 39; , user = nil , password = nil , authtype = DEFAULT _ AUTH _ TYPE) -> Net :: SMTP (20.0) -
新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
...新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
以下と同じです。
require 'net/smtp'
Net::SMTP.new(address, port).start(helo: helo, user: user, password: password, authtype: authtype)
このメソッドにブロックを与......証を行います。
authtype は使用する認証のタイプで、
シンボルで :plain, :login, :cram_md5 を指定します。
Example:
require 'net/smtp'
Net::SMTP.start('smtp.example.com') {|smtp|
smtp.send_message mail_string, 'from@example.jp', 'to@example.jp'
}
@param addr......します
@param port ポート番号、デフォルトは 25 です
@param tls_verify サーバー証明書を検証するか否か
@param tls_hostname サーバー証明書のホスト名
@param helo HELO で名乗るドメイン名です
@param user 認証で使うアカウント名
@param passwo... -
Net
:: SMTP . start(address , port = Net :: SMTP . default _ port , helo = & # 39;localhost& # 39; , user = nil , password = nil , authtype = DEFAULT _ AUTH _ TYPE) {|smtp| . . . . } -> object (20.0) -
新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
...新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
以下と同じです。
require 'net/smtp'
Net::SMTP.new(address, port).start(helo: helo, user: user, password: password, authtype: authtype)
このメソッドにブロックを与......証を行います。
authtype は使用する認証のタイプで、
シンボルで :plain, :login, :cram_md5 を指定します。
Example:
require 'net/smtp'
Net::SMTP.start('smtp.example.com') {|smtp|
smtp.send_message mail_string, 'from@example.jp', 'to@example.jp'
}
@param addr......します
@param port ポート番号、デフォルトは 25 です
@param tls_verify サーバー証明書を検証するか否か
@param tls_hostname サーバー証明書のホスト名
@param helo HELO で名乗るドメイン名です
@param user 認証で使うアカウント名
@param passwo... -
Array
# pack(template) -> String (18.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N").pack("l").unpack("l")[0]
n # => -2
//}
: IPアドレス
//emlist[][ruby]{
require 'socket'
official_hostname, alias_hostnames, address_family, *address_list = Socket.gethostbyname("localhost")
address_list.find {|address| address.size == 4 }.unpack......")
# => "127.0.0.1"
"127.0.0.1".split(".").collect {|c| c.to_i}.pack("C4")
# => "\x7F\x00\x00\x01"
//}
: sockaddr_in 構造体
//emlist[][ruby]{
require 'socket'
[Socket::AF_INET,
Socket.getservbyname('echo'),
127, 0, 0, 1].pack("s n C4 x8")
# => "\x02\x00\x00\a\x7F\x00\x00\x01\x00\x00\x00\x00\x... -
Array
# pack(template , buffer: String . new) -> String (18.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N").pack("l").unpack("l")[0]
n # => -2
//}
: IPアドレス
//emlist[][ruby]{
require 'socket'
official_hostname, alias_hostnames, address_family, *address_list = Socket.gethostbyname("localhost")
address_list.find {|address| address.size == 4 }.unpack......")
# => "127.0.0.1"
"127.0.0.1".split(".").collect {|c| c.to_i}.pack("C4")
# => "\x7F\x00\x00\x01"
//}
: sockaddr_in 構造体
//emlist[][ruby]{
require 'socket'
[Socket::AF_INET,
Socket.getservbyname('echo'),
127, 0, 0, 1].pack("s n C4 x8")
# => "\x02\x00\x00\a\x7F\x00\x00\x01\x00\x00\x00\x00\x... -
Net
:: SMTP . start(address , port = Net :: SMTP . default _ port , helo = & # 39;localhost& # 39; , user = nil , password = nil , authtype = DEFAULT _ AUTH _ TYPE) -> Net :: SMTP (18.0) -
新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
...新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
以下と同じです。
require 'net/smtp'
Net::SMTP.new(address, port).start(helo, user, password, authtype)
このメソッドにブロックを与えた場合には、新しく......証を行います。
authtype は使用する認証のタイプで、
シンボルで :plain, :login, :cram_md5 を指定します。
Example:
require 'net/smtp'
Net::SMTP.start('smtp.example.com') {|smtp|
smtp.send_message mail_string, 'from@example.jp', 'to@example.jp'
}
@param addr......します
@param port ポート番号、デフォルトは 25 です
@param tls_verify サーバー証明書を検証するか否か
@param tls_hostname サーバー証明書のホスト名
@param helo HELO で名乗るドメイン名です
@param user 認証で使うアカウント名
@param passwo... -
Net
:: SMTP . start(address , port = Net :: SMTP . default _ port , helo = & # 39;localhost& # 39; , user = nil , password = nil , authtype = DEFAULT _ AUTH _ TYPE) {|smtp| . . . . } -> object (18.0) -
新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
...新しい SMTP オブジェクトを生成し、サーバに接続し、セッションを開始します。
以下と同じです。
require 'net/smtp'
Net::SMTP.new(address, port).start(helo, user, password, authtype)
このメソッドにブロックを与えた場合には、新しく......証を行います。
authtype は使用する認証のタイプで、
シンボルで :plain, :login, :cram_md5 を指定します。
Example:
require 'net/smtp'
Net::SMTP.start('smtp.example.com') {|smtp|
smtp.send_message mail_string, 'from@example.jp', 'to@example.jp'
}
@param addr......します
@param port ポート番号、デフォルトは 25 です
@param tls_verify サーバー証明書を検証するか否か
@param tls_hostname サーバー証明書のホスト名
@param helo HELO で名乗るドメイン名です
@param user 認証で使うアカウント名
@param passwo... -
String
# unpack(template) -> Array (18.0) -
Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。
...[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N").pack("l").unpack("l")[0]
n # => -2
//}
: IPアドレス
//emlist[][ruby]{
require 'socket'
official_hostname, alias_hostnames, address_family, *address_list = Socket.gethostbyname("localhost")
address_list.find {|address| address.size == 4 }.unpack......")
# => "127.0.0.1"
"127.0.0.1".split(".").collect {|c| c.to_i}.pack("C4")
# => "\x7F\x00\x00\x01"
//}
: sockaddr_in 構造体
//emlist[][ruby]{
require 'socket'
[Socket::AF_INET,
Socket.getservbyname('echo'),
127, 0, 0, 1].pack("s n C4 x8")
# => "\x02\x00\x00\a\x7F\x00\x00\x01\x00\x00\x00\x00\x...