Skip to content

Commit

Permalink
Merge pull request #61 from ruby/remove_SMTPUTF8RequiredError
Browse files Browse the repository at this point in the history
remove SMTPUTF8RequiredError
  • Loading branch information
tmtm authored Sep 20, 2023
2 parents 8d40ff2 + 83c1587 commit 531c797
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
9 changes: 1 addition & 8 deletions lib/net/smtp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ class SMTPUnsupportedCommand < ProtocolError
include SMTPError
end

# Represents a need to use SMTPUTF8 when the server does not support it
class SMTPUTF8RequiredError < SMTPUnsupportedCommand
end

#
# == What is This Library?
#
Expand Down Expand Up @@ -760,7 +756,6 @@ def any_require_smtputf8(addresses)
# * Net::SMTPServerBusy
# * Net::SMTPSyntaxError
# * Net::SMTPFatalError
# * Net::SMTPUTF8RequiredError
# * Net::SMTPUnknownError
# * Net::ReadTimeout
# * IOError
Expand Down Expand Up @@ -816,7 +811,6 @@ def send_message(msgstr, from_addr, *to_addrs)
# * Net::SMTPServerBusy
# * Net::SMTPSyntaxError
# * Net::SMTPFatalError
# * Net::SMTPUTF8RequiredError
# * Net::SMTPUnknownError
# * Net::ReadTimeout
# * IOError
Expand Down Expand Up @@ -893,8 +887,7 @@ def ehlo(domain)

# +from_addr+ is +String+ or +Net::SMTP::Address+
def mailfrom(from_addr)
addr = if requires_smtputf8(from_addr)
raise SMTPUTF8RequiredError, "Message requires SMTPUTF8 but server does not support that" unless capable? "SMTPUTF8"
addr = if requires_smtputf8(from_addr) && capable?("SMTPUTF8")
Address.new(from_addr, "SMTPUTF8")
else
Address.new(from_addr)
Expand Down
5 changes: 2 additions & 3 deletions test/net/smtp/test_smtp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,8 @@ def test_start_instance_invalid_number_of_arguments
def test_send_smtputf_sender_without_server
server = FakeServer.start(smtputf8: false)
smtp = Net::SMTP.start 'localhost', server.port
assert_raise(Net::SMTPUTF8RequiredError) do
smtp.send_message('message', 'rené@example.com')
end
smtp.send_message('message', 'rené@example.com', 'foo@example.com')
assert server.commands.include? "MAIL FROM:<rené@example.com>\r\n"
end

def test_send_smtputf8_sender
Expand Down

0 comments on commit 531c797

Please sign in to comment.