0
MSG_TEMPLATE = File.dirname(__FILE__) + '/email.erb'
0
-FROM = 'macournoyer@gmail.com'
0
-SEND_ANN_TO = %w(thin-ruby@googlegroups.com eventmachine-talk@rubyforge.org Rubymtl@lists.artengine.ca ruby-talk@ruby-lang.org)
0
+SEND_TO = %w(thin-ruby@googlegroups.com eventmachine-talk@rubyforge.org Rubymtl@lists.artengine.ca ruby-talk@ruby-lang.org)
0
- desc 'Send the new version annoucement by email'
0
- abort 'Specify PW for GMail account' unless ENV['PW']
0
+desc 'Generate a template for the new version annoucement'
0
+ msg = ERB.new(File.read(MSG_TEMPLATE)).result(binding)
0
- (ENV['TEST'] ? %w(macournoyer@yahoo.ca) : SEND_ANN_TO).each do |to|
0
- msg = ERB.new(File.read(MSG_TEMPLATE)).result(binding)
0
- body = <<END_OF_MESSAGE
0
-From: Marc-Andre Cournoyer <#{FROM}>
0
+ body = <<END_OF_MESSAGE
0
Subject: [ANN] Thin #{Thin::VERSION::STRING} #{Thin::VERSION::CODENAME} released
0
-Date: #{Time.now.httpdate}
0
-Message-Id: <unique.message.id.string@example.com>
0
- Net::SMTP.start('smtp.gmail.com', 587, 'localhost.localdomain',
0
- 'macournoyer', ENV['PW'], :plain) do |smtp|
0
- smtp.send_message body, FROM, to
0
-# Require some magic stuff for sending mails using Gmail
0
-# Source: http://d.hatena.ne.jp/zorio/20060416
0
-Net::SMTP.class_eval do
0
- def do_start(helodomain, user, secret, authtype)
0
- raise IOError, 'SMTP session already started' if @started
0
- check_auth_args user, secret, authtype if user or secret
0
- sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
0
- @socket = Net::InternetMessageIO.new(sock)
0
- @socket.read_timeout = 60 #@read_timeout
0
- @socket.debug_output = STDERR #@debug_output
0
- check_response(critical { recv_response() })
0
- raise 'openssl library not installed' unless defined?(OpenSSL)
0
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
0
- @socket = Net::InternetMessageIO.new(ssl)
0
- @socket.read_timeout = 60 #@read_timeout
0
- @socket.debug_output = STDERR #@debug_output
0
- authenticate user, secret, authtype if user
0
- # authentication failed, cancel connection.
0
- @socket.close if not @started and @socket and not @socket.closed?
0
- def do_helo(helodomain)
0
- rescue Net::ProtocolError
0
- @error_occured = false
Comments
No one has commented yet.