Skip to content

Commit

Permalink
#27 --proxy disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jun 23, 2024
1 parent 2a66fe8 commit 4783519
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ coverage/
.bundle/
.DS_Store
rdoc/
doc/
.yardoc/
37 changes: 10 additions & 27 deletions bin/rumble
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ STDOUT.sync = true

require 'slop'
require 'mail'
require 'net/smtp/proxy'
require_relative '../lib/rumble'
require_relative '../lib/rumble/version'
require_relative '../lib/rumble/cli'
Expand Down Expand Up @@ -99,32 +98,16 @@ begin
raise '--user is required' unless opts[:user]
raise '--password is required' unless opts[:password]
from = Mail::Address.new(opts[:from])
if opts[:proxy]
scheme, host, port = opts[:proxy].strip.split(':')
delivery_method Net::SMTP::Proxy::DeliveryMethod, {
domain: from.domain,
address: opts[:host],
port: opts[:port],
proxy_address: "#{scheme}://#{host}",
proxy_port: port.to_i,
authentication: 'plain',
openssl_verify_mode: OpenSSL::SSL::VERIFY_NONE,
enable_starttls_auto: true,
enable_starttls: true,
user_name: opts[:user],
password: opts[:password]
}
else
delivery_method :smtp, {
domain: from.domain,
address: opts[:host],
port: opts[:port],
user_name: opts[:user],
password: opts[:password],
enable_starttls: true,
enable_starttls_auto: true
}
end
raise 'The --proxy option is not supporte' if opts[:proxy]
delivery_method :smtp, {
domain: from.domain,
address: opts[:host],
port: opts[:port],
user_name: opts[:user],
password: opts[:password],
enable_starttls: true,
enable_starttls_auto: true
}
else
raise "Delivery method #{opts[:method]} is not supported"
end
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

Given(/^I have a "([^"]*)" file with content:$/) do |file, text|
FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(file)
File.write(file, text.gsub(/\\xFF/, 0xFF.chr))
File.write(file, text.gsub('\\xFF', 0xFF.chr))
end

When(%r{^I run bin/rumble with "([^"]*)"$}) do |arg|
Expand Down

0 comments on commit 4783519

Please sign in to comment.