Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove SMTPUTF8RequiredError #61

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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', '[email protected]')
assert server.commands.include? "MAIL FROM:<rené@example.com>\r\n"
end

def test_send_smtputf8_sender
Expand Down