smtp_tls 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,12 @@
1
+ === 1.0.3 / 2009-07-??
2
+
3
+ * 1 minor enhancement
4
+ * Added mail_smtp_tls executable to test SMTP connections
5
+
6
+ * 2 bug fixes
7
+ * Suppress default DH parameters warning
8
+ * Pass debug output down to child IOs
9
+
1
10
  === 1.0.2 / 2009-06-25
2
11
 
3
12
  * 1 major enhancement
@@ -2,4 +2,5 @@ History.txt
2
2
  Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
+ bin/mail_smtp_tls
5
6
  lib/smtp_tls.rb
data/README.txt CHANGED
@@ -20,6 +20,51 @@ servers that use STARTTLS.
20
20
  server.send_message message, from, to
21
21
  end
22
22
 
23
+ You can also test your SMTP connection settings using mail_smtp_tls:
24
+
25
+ $ date | ruby -Ilib bin/mail_smtp_tls smtp.example.com submission \
26
+ "your username" "your password" plain \
27
+ from@example.com to@example.com
28
+ Using SMTP_TLS 1.0.3
29
+ -> "220 smtp.example.com ESMTP XXX\r\n"
30
+ <- "EHLO you.example.com\r\n"
31
+ -> "250-smtp.example.com at your service, [192.0.2.1]\r\n"
32
+ -> "250-SIZE 35651584\r\n"
33
+ -> "250-8BITMIME\r\n"
34
+ -> "250-STARTTLS\r\n"
35
+ -> "250-ENHANCEDSTATUSCODES\r\n"
36
+ -> "250 PIPELINING\r\n"
37
+ <- "STARTTLS\r\n"
38
+ -> "220 2.0.0 Ready to start TLS\r\n"
39
+ TLS connection started
40
+ <- "EHLO you.example.com\r\n"
41
+ -> "250-smtp.example.com at your service, [192.0.2.1]\r\n"
42
+ -> "250-SIZE 35651584\r\n"
43
+ -> "250-8BITMIME\r\n"
44
+ -> "250-AUTH LOGIN PLAIN\r\n"
45
+ -> "250-ENHANCEDSTATUSCODES\r\n"
46
+ -> "250 PIPELINING\r\n"
47
+ <- "AUTH PLAIN BASE64_STUFF_HERE\r\n"
48
+ -> "235 2.7.0 Accepted\r\n"
49
+ <- "MAIL FROM:<from@example.com>\r\n"
50
+ -> "250 2.1.0 OK XXX\r\n"
51
+ <- "RCPT TO:<to@example.com>\r\n"
52
+ -> "250 2.1.5 OK XXX\r\n"
53
+ <- "DATA\r\n"
54
+ -> "354 Go ahead XXX\r\n"
55
+ writing message from String
56
+ wrote 91 bytes
57
+ -> "250 2.0.0 OK 1247028988 XXX\r\n"
58
+ <- "QUIT\r\n"
59
+ -> "221 2.0.0 closing connection XXX\r\n"
60
+
61
+ This will connect to smtp.example.com using the submission port (port 587)
62
+ with a username and password of "your username" and "your password" and
63
+ authenticate using plain-text auth (the submission port always uses SSL) then
64
+ send the current date to to@example.com from from@example.com.
65
+
66
+ Debug output from the connection will be printed on stderr.
67
+
23
68
  == INSTALL:
24
69
 
25
70
  sudo gem install smtp_tls
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ require 'net/smtp'
4
+ require 'rubygems'
5
+ begin
6
+ require 'smtp_tls'
7
+ rescue LoadError
8
+ end
9
+
10
+ if defined?(Net::SMTP::SMTP_TLS) then
11
+ $stderr.puts "Using SMTP_TLS #{Net::SMTP::SMTP_TLS::VERSION}"
12
+ else
13
+ $stderr.puts "Using ruby's built-in SMTP TLS support"
14
+ end
15
+
16
+ if ARGV.empty? then
17
+ puts "#{$0} host port user password auth_type from to"
18
+ puts "Then type your message on STDIN"
19
+ abort
20
+ end
21
+
22
+ host = ARGV.shift
23
+ port = ARGV.shift
24
+ port = if port =~ /\d/ then
25
+ port.to_i
26
+ else
27
+ Socket.getservbyname port
28
+ end
29
+ user = ARGV.shift
30
+ password = ARGV.shift
31
+ auth_type = ARGV.shift.intern
32
+ from = ARGV.shift
33
+ to = ARGV.shift
34
+
35
+ message = <<MESSAGE
36
+ From: #{from}\r
37
+ To: #{to}\r
38
+ \r
39
+ #{$stdin.read}
40
+ MESSAGE
41
+
42
+ begin
43
+ $stderr.sync = true
44
+ smtp = Net::SMTP.new host, port
45
+ smtp.set_debug_output $stderr
46
+ smtp.enable_starttls if port != Socket.getservbyname('smtp')
47
+ smtp.start Socket.gethostname, user, password, auth_type do |server|
48
+ server.send_message message, from, to
49
+ end
50
+ rescue Net::SMTPError => e
51
+ puts e.message
52
+ exit 1
53
+ end
@@ -7,7 +7,7 @@ require 'net/smtp'
7
7
  class Net::SMTP
8
8
 
9
9
  class SMTP_TLS
10
- VERSION = '1.0.2'
10
+ VERSION = '1.0.3'
11
11
  end
12
12
 
13
13
  class << self
@@ -70,6 +70,7 @@ class Net::SMTP
70
70
 
71
71
  sock = timeout(@open_timeout) { TCPSocket.open @address, @port }
72
72
  @socket = Net::InternetMessageIO.new(sock)
73
+ @socket.debug_output = @debug_output
73
74
  @socket.read_timeout = 60 # @read_timeout
74
75
 
75
76
  check_response(critical { recv_response() })
@@ -77,7 +78,9 @@ class Net::SMTP
77
78
 
78
79
  raise 'openssl library not installed' unless defined?(OpenSSL)
79
80
  starttls
81
+ @ssl_context.tmp_dh_callback = proc { }
80
82
  ssl = OpenSSL::SSL::SSLSocket.new sock, @ssl_context
83
+ @debug_output << "TLS connection started\n" if @debug_output
81
84
  ssl.sync_close = true
82
85
  ssl.connect
83
86
  if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE then
@@ -85,6 +88,7 @@ class Net::SMTP
85
88
  end
86
89
 
87
90
  @socket = Net::InternetMessageIO.new ssl
91
+ @socket.debug_output = @debug_output
88
92
  @socket.read_timeout = 60 # @read_timeout
89
93
  do_helo helodomain
90
94
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smtp_tls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -31,7 +31,7 @@ cert_chain:
31
31
  x52qPcexcYZR7w==
32
32
  -----END CERTIFICATE-----
33
33
 
34
- date: 2009-06-25 00:00:00 -07:00
34
+ date: 2009-07-08 00:00:00 -07:00
35
35
  default_executable:
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 2.3.0
45
+ version: 2.3.2
46
46
  version:
47
47
  description: |-
48
48
  Provides SMTP STARTTLS support for Ruby 1.8.6 (built-in for 1.8.7+). Simply
@@ -60,11 +60,56 @@ description: |-
60
60
  smtp.start Socket.gethostname, user, password, authentication do |server|
61
61
  server.send_message message, from, to
62
62
  end
63
+
64
+ You can also test your SMTP connection settings using mail_smtp_tls:
65
+
66
+ $ date | ruby -Ilib bin/mail_smtp_tls smtp.example.com submission \
67
+ "your username" "your password" plain \
68
+ from@example.com to@example.com
69
+ Using SMTP_TLS 1.0.3
70
+ -> "220 smtp.example.com ESMTP XXX\r\n"
71
+ <- "EHLO you.example.com\r\n"
72
+ -> "250-smtp.example.com at your service, [192.0.2.1]\r\n"
73
+ -> "250-SIZE 35651584\r\n"
74
+ -> "250-8BITMIME\r\n"
75
+ -> "250-STARTTLS\r\n"
76
+ -> "250-ENHANCEDSTATUSCODES\r\n"
77
+ -> "250 PIPELINING\r\n"
78
+ <- "STARTTLS\r\n"
79
+ -> "220 2.0.0 Ready to start TLS\r\n"
80
+ TLS connection started
81
+ <- "EHLO you.example.com\r\n"
82
+ -> "250-smtp.example.com at your service, [192.0.2.1]\r\n"
83
+ -> "250-SIZE 35651584\r\n"
84
+ -> "250-8BITMIME\r\n"
85
+ -> "250-AUTH LOGIN PLAIN\r\n"
86
+ -> "250-ENHANCEDSTATUSCODES\r\n"
87
+ -> "250 PIPELINING\r\n"
88
+ <- "AUTH PLAIN BASE64_STUFF_HERE\r\n"
89
+ -> "235 2.7.0 Accepted\r\n"
90
+ <- "MAIL FROM:<from@example.com>\r\n"
91
+ -> "250 2.1.0 OK XXX\r\n"
92
+ <- "RCPT TO:<to@example.com>\r\n"
93
+ -> "250 2.1.5 OK XXX\r\n"
94
+ <- "DATA\r\n"
95
+ -> "354 Go ahead XXX\r\n"
96
+ writing message from String
97
+ wrote 91 bytes
98
+ -> "250 2.0.0 OK 1247028988 XXX\r\n"
99
+ <- "QUIT\r\n"
100
+ -> "221 2.0.0 closing connection XXX\r\n"
101
+
102
+ This will connect to smtp.example.com using the submission port (port 587)
103
+ with a username and password of "your username" and "your password" and
104
+ authenticate using plain-text auth (the submission port always uses SSL) then
105
+ send the current date to to@example.com from from@example.com.
106
+
107
+ Debug output from the connection will be printed on stderr.
63
108
  email:
64
109
  - drbrain@segment7.net
65
110
  - ""
66
- executables: []
67
-
111
+ executables:
112
+ - mail_smtp_tls
68
113
  extensions: []
69
114
 
70
115
  extra_rdoc_files:
@@ -76,6 +121,7 @@ files:
76
121
  - Manifest.txt
77
122
  - README.txt
78
123
  - Rakefile
124
+ - bin/mail_smtp_tls
79
125
  - lib/smtp_tls.rb
80
126
  has_rdoc: true
81
127
  homepage: http://seattlerb.rubyforge.org/smtp_tls
metadata.gz.sig CHANGED
Binary file