tlsmail 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ require "net/smtp"
2
+ require "net/pop"
3
+ # If smtp or pop is already loaded, remove all constants.
4
+ module Net
5
+ if defined?(SMTP)
6
+ SMTP.class_eval do remove_const(:Revision) end
7
+ [:SMTP, :SMTPSession].each do |c|
8
+ remove_const(c) if constants.include?(c.to_s)
9
+ end
10
+ end
11
+ if defined?(POP)
12
+ POP.class_eval do remove_const(:Revision) end
13
+ [:POP, :POPSession, :POP3Session, :APOPSession].each do |c|
14
+ remove_const(c) if constants.include?(c.to_s)
15
+ end
16
+ end
17
+ end
18
+
19
+ load File.dirname(__FILE__) + "/net/smtp.rb"
20
+ load File.dirname(__FILE__) + "/net/pop.rb"
21
+
22
+ Net::SMTP.class_eval do
23
+ def quit # gmail smtp server disconnects as soon as get quit message.
24
+ begin
25
+ getok('QUIT')
26
+ rescue EOFError
27
+ end
28
+ end
29
+ end
30
+
@@ -0,0 +1,10 @@
1
+ # This file is a template for parameters.rb
2
+ # Copy this file and change variables below.
3
+ SMTP_SERVER = "smtp.gmail.com"
4
+ SMTP_PORT = "587"
5
+ POP_SERVER = "pop.gmail.com"
6
+ POP_PORT = "995"
7
+ DOMAIN = "localhost.localdomain"
8
+ AUTH = :plain
9
+ USER = "XXXXXXXXXXXX@gmail.com"
10
+ PASS = "ZZZZZZZZZZ"
@@ -0,0 +1,4 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/tlsmail'
4
+ require "parameters"
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TlsmailTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_truth
9
+ assert true
10
+ end
11
+
12
+ def test_send_mail
13
+ require "time"
14
+ msgstr = <<END_OF_MESSAGE
15
+ From: Your Name <#{USER}@gmail.com>
16
+ To: Destination Address <#{USER}@gmail.com>
17
+ Subject: test message
18
+ Date: #{Time.now.rfc2822}
19
+
20
+ test message.
21
+ END_OF_MESSAGE
22
+ Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
23
+ Net::SMTP.start(SMTP_SERVER, SMTP_PORT, DOMAIN, USER, PASS, AUTH) do |smtp|
24
+ smtp.send_message msgstr, "#{USER}@gmail.com", "#{USER}@gmail.com"
25
+ end
26
+ end
27
+
28
+ def test_receive_mail
29
+ Net::POP.enable_ssl(OpenSSL::SSL::VERIFY_NONE)
30
+ Net::POP.start(POP_SERVER, POP_PORT, USER, PASS) do |pop|
31
+ p pop.mails[0].pop
32
+ end
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: tlsmail
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.1
7
+ date: 2007-03-18 00:00:00 +09:00
8
+ summary: This library enables pop or smtp via ssl/tls by dynamically replacing these classes to these in ruby 1.9.
9
+ require_paths:
10
+ - lib
11
+ email: zoriorz@gmail.com
12
+ homepage: http://tlsmail.rubyforge.org
13
+ rubyforge_project: tlsmail
14
+ description: This library enables pop or smtp via ssl/tls by dynamically replacing these classes to these in ruby 1.9.
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - zorio
31
+ files:
32
+ - Rakefile
33
+ - README.txt
34
+ - CHANGELOG.txt
35
+ - Manifest.txt
36
+ - lib/tlsmail.rb
37
+ - lib/net/pop.rb
38
+ - lib/net/smtp.rb
39
+ - test/test_helper.rb
40
+ - test/tlsmail_test.rb
41
+ - test/template.parameters.rb
42
+ test_files:
43
+ - test/tlsmail_test.rb
44
+ rdoc_options: []
45
+
46
+ extra_rdoc_files: []
47
+
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ requirements: []
53
+
54
+ dependencies: []
55
+