Fix exception for blank body in SMTP server

This commit is contained in:
Patrick Gansterer 2020-03-04 16:58:33 +01:00
parent 645c142bf6
commit f5bbe0d5ae

View file

@ -34,10 +34,7 @@ class MessagesMailReceiver
body.encode!(Encoding::default_internal) body.encode!(Encoding::default_internal)
body = EmailReplyTrimmer.trim(body) body = EmailReplyTrimmer.trim(body)
raise BlankBodyException if body.empty?
if body.empty?
raise MidiSmtpServer::SmtpdException(nil, 541, "The recipient address rejected your message because of a blank plain body")
end
message = @user.send_messages.new body: body, message = @user.send_messages.new body: body,
group: @message.group, group: @message.group,
@ -75,4 +72,12 @@ class MessagesMailReceiver
mail_part mail_part
end end
class BlankBodyException < MidiSmtpServer::SmtpdException
def initialize(msg = nil)
super msg, 541, 'The recipient address rejected your message because of a blank plain body'
end
end
end end