diff --git a/lib/postal/smtp_sender.rb b/lib/postal/smtp_sender.rb index cc74b16f..47c3c01a 100644 --- a/lib/postal/smtp_sender.rb +++ b/lib/postal/smtp_sender.rb @@ -58,6 +58,7 @@ def start # Set the source IP as appropriate smtp_client.source_address = ip_type == :aaaa ? @source_ip_address.ipv6 : @source_ip_address.ipv4 end + case ssl_mode when "Auto" smtp_client.enable_starttls_auto(self.class.ssl_context_without_verify) @@ -65,6 +66,9 @@ def start smtp_client.enable_starttls(self.class.ssl_context_with_verify) when "TLS" smtp_client.enable_tls(self.class.ssl_context_with_verify) + else + smtp_client.disable_starttls + smtp_client.disable_tls end smtp_client.start(@source_ip_address ? @source_ip_address.hostname : self.class.default_helo_hostname) diff --git a/script/send_html_email.rb b/script/send_html_email.rb index 9e8e4bb1..96ead18e 100644 --- a/script/send_html_email.rb +++ b/script/send_html_email.rb @@ -40,10 +40,24 @@ BODY end -# puts mail.to_s +c = OpenSSL::SSL::SSLContext.new +c.verify_mode = OpenSSL::SSL::VERIFY_NONE +<<<<<<< Updated upstream Net::SMTP.start("127.0.0.1", 2525) do |smtp| smtp.send_message mail.to_s, mail.from.first, mail.to.first end +======= +1000.times.map do + Thread.new do + smtp = Net::SMTP.new("77.72.7.155", 25) + # smtp.enable_starttls(c) + smtp.disable_starttls + smtp.start("localhost") + smtp.send_message mail.to_s, mail.from.first, mail.to.first + smtp.finish + end +end.each(&:join) +>>>>>>> Stashed changes puts "Sent"