net-smtp 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/net/smtp.rb +58 -9
- data/net-smtp.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbf12984985ffef0271f09805060b2cfa5e72eb3955c8ce51ee8076b427e1a02
|
4
|
+
data.tar.gz: 17c6420b495abe8b17446b1e667681b2680b02d894b3ce1e4ef6cffaa26ad1df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d9372a9673256cc280600a1367a0c92bed91250209736b4b54c7219c115b1006e9fc66d465367729f53ef393b9a8077b33f11f7578365d9cb84051e44b86976
|
7
|
+
data.tar.gz: 0f7da80c1d40216684ff0927637b14dfb5597638913a0aa3a8f2ca68a3fc89724926736c719715171b7bcab915a9504016f10356b2622bc6da9e5f51238f8e52
|
data/lib/net/smtp.rb
CHANGED
@@ -179,7 +179,7 @@ module Net
|
|
179
179
|
# user: 'Your Account', secret: 'Your Password', authtype: :cram_md5)
|
180
180
|
#
|
181
181
|
class SMTP < Protocol
|
182
|
-
VERSION = "0.3.
|
182
|
+
VERSION = "0.3.1"
|
183
183
|
|
184
184
|
Revision = %q$Revision$.split[1]
|
185
185
|
|
@@ -251,6 +251,15 @@ module Net
|
|
251
251
|
@ssl_context_params = ssl_context_params
|
252
252
|
end
|
253
253
|
|
254
|
+
# If +true+, verify th server's certificate.
|
255
|
+
attr_accessor :tls_verify
|
256
|
+
|
257
|
+
# The hostname for verifying hostname in the server certificatate.
|
258
|
+
attr_accessor :tls_hostname
|
259
|
+
|
260
|
+
# Hash for additional SSLContext parameters.
|
261
|
+
attr_accessor :ssl_context_params
|
262
|
+
|
254
263
|
# Provide human-readable stringification of class state.
|
255
264
|
def inspect
|
256
265
|
"#<#{self.class} #{@address}:#{@port} started=#{@started}>"
|
@@ -274,11 +283,14 @@ module Net
|
|
274
283
|
capable?('STARTTLS')
|
275
284
|
end
|
276
285
|
|
286
|
+
# true if the EHLO response contains +key+.
|
277
287
|
def capable?(key)
|
278
288
|
return nil unless @capabilities
|
279
289
|
@capabilities[key] ? true : false
|
280
290
|
end
|
281
|
-
|
291
|
+
|
292
|
+
# The server capabilities by EHLO response
|
293
|
+
attr_reader :capabilities
|
282
294
|
|
283
295
|
# true if server advertises AUTH PLAIN.
|
284
296
|
# You cannot get valid value before opening SMTP session.
|
@@ -703,9 +715,9 @@ module Net
|
|
703
715
|
# binary message with this method. +msgstr+ should include both
|
704
716
|
# the message headers and body.
|
705
717
|
#
|
706
|
-
# +from_addr+ is a String representing the source mail address.
|
718
|
+
# +from_addr+ is a String or Net::SMTP::Address representing the source mail address.
|
707
719
|
#
|
708
|
-
# +to_addr+ is a String or
|
720
|
+
# +to_addr+ is a String or Net::SMTP::Address or Array of them, representing
|
709
721
|
# the destination mail address or addresses.
|
710
722
|
#
|
711
723
|
# === Example
|
@@ -716,6 +728,12 @@ module Net
|
|
716
728
|
# ['dest@example.com', 'dest2@example.com']
|
717
729
|
# end
|
718
730
|
#
|
731
|
+
# Net::SMTP.start('smtp.example.com') do |smtp|
|
732
|
+
# smtp.send_message msgstr,
|
733
|
+
# Net::SMTP::Address.new('from@example.com', size: 12345),
|
734
|
+
# Net::SMTP::Address.new('dest@example.com', notify: :success)
|
735
|
+
# end
|
736
|
+
#
|
719
737
|
# === Errors
|
720
738
|
#
|
721
739
|
# This method may raise:
|
@@ -752,9 +770,9 @@ module Net
|
|
752
770
|
#
|
753
771
|
# === Parameters
|
754
772
|
#
|
755
|
-
# +from_addr+ is a String representing the source mail address.
|
773
|
+
# +from_addr+ is a String or Net::SMTP::Address representing the source mail address.
|
756
774
|
#
|
757
|
-
# +to_addr+ is a String or
|
775
|
+
# +to_addr+ is a String or Net::SMTP::Address or Array of them, representing
|
758
776
|
# the destination mail address or addresses.
|
759
777
|
#
|
760
778
|
# === Example
|
@@ -904,8 +922,10 @@ module Net
|
|
904
922
|
getok("EHLO #{domain}")
|
905
923
|
end
|
906
924
|
|
925
|
+
# +from_addr+ is +String+ or +Net::SMTP::Address+
|
907
926
|
def mailfrom(from_addr)
|
908
|
-
|
927
|
+
addr = Address.new(from_addr)
|
928
|
+
getok((["MAIL FROM:<#{addr.address}>"] + addr.parameters).join(' '))
|
909
929
|
end
|
910
930
|
|
911
931
|
def rcptto_list(to_addrs)
|
@@ -916,7 +936,7 @@ module Net
|
|
916
936
|
begin
|
917
937
|
rcptto addr
|
918
938
|
rescue SMTPAuthenticationError
|
919
|
-
unknown_users << addr.dump
|
939
|
+
unknown_users << addr.to_s.dump
|
920
940
|
else
|
921
941
|
ok_users << addr
|
922
942
|
end
|
@@ -929,8 +949,10 @@ module Net
|
|
929
949
|
ret
|
930
950
|
end
|
931
951
|
|
952
|
+
# +to_addr+ is +String+ or +Net::SMTP::Address+
|
932
953
|
def rcptto(to_addr)
|
933
|
-
|
954
|
+
addr = Address.new(to_addr)
|
955
|
+
getok((["RCPT TO:<#{addr.address}>"] + addr.parameters).join(' '))
|
934
956
|
end
|
935
957
|
|
936
958
|
# This method sends a message.
|
@@ -1139,6 +1161,33 @@ module Net
|
|
1139
1161
|
@debug_output << msg + "\n" if @debug_output
|
1140
1162
|
end
|
1141
1163
|
|
1164
|
+
# Address with parametres for MAIL or RCPT command
|
1165
|
+
class Address
|
1166
|
+
# mail address [String]
|
1167
|
+
attr_reader :address
|
1168
|
+
# paramters [Array<String>]
|
1169
|
+
attr_reader :parameters
|
1170
|
+
|
1171
|
+
# :call-seq:
|
1172
|
+
# initialize(address, parameter, ...)
|
1173
|
+
#
|
1174
|
+
# address +String+ or +Net::SMTP::Address+
|
1175
|
+
# parameter +String+ or +Hash+
|
1176
|
+
def initialize(address, *args, **kw_args)
|
1177
|
+
if address.kind_of? Address
|
1178
|
+
@address = address.address
|
1179
|
+
@parameters = address.parameters
|
1180
|
+
else
|
1181
|
+
@address = address
|
1182
|
+
@parameters = (args + [kw_args]).map{|param| Array(param)}.flatten(1).map{|param| Array(param).compact.join('=')}
|
1183
|
+
end
|
1184
|
+
end
|
1185
|
+
|
1186
|
+
def to_s
|
1187
|
+
@address
|
1188
|
+
end
|
1189
|
+
end
|
1190
|
+
|
1142
1191
|
end # class SMTP
|
1143
1192
|
|
1144
1193
|
SMTPSession = SMTP # :nodoc:
|
data/net-smtp.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.description = %q{Simple Mail Transfer Protocol client library for Ruby.}
|
18
18
|
spec.homepage = "https://github.com/ruby/net-smtp"
|
19
19
|
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
20
|
-
spec.required_ruby_version = ">= 2.
|
20
|
+
spec.required_ruby_version = ">= 2.6.0"
|
21
21
|
|
22
22
|
spec.metadata["homepage_uri"] = spec.homepage
|
23
23
|
spec.metadata["source_code_uri"] = spec.homepage
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-smtp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukihiro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-protocol
|
@@ -77,14 +77,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: 2.
|
80
|
+
version: 2.6.0
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
|
-
rubygems_version: 3.
|
87
|
+
rubygems_version: 3.3.0.dev
|
88
88
|
signing_key:
|
89
89
|
specification_version: 4
|
90
90
|
summary: Simple Mail Transfer Protocol client library for Ruby.
|