Fix exception for blank body in SMTP server
This commit is contained in:
parent
645c142bf6
commit
f5bbe0d5ae
1 changed files with 9 additions and 4 deletions
|
@ -34,10 +34,7 @@ class MessagesMailReceiver
|
|||
|
||||
body.encode!(Encoding::default_internal)
|
||||
body = EmailReplyTrimmer.trim(body)
|
||||
|
||||
if body.empty?
|
||||
raise MidiSmtpServer::SmtpdException(nil, 541, "The recipient address rejected your message because of a blank plain body")
|
||||
end
|
||||
raise BlankBodyException if body.empty?
|
||||
|
||||
message = @user.send_messages.new body: body,
|
||||
group: @message.group,
|
||||
|
@ -75,4 +72,12 @@ class MessagesMailReceiver
|
|||
mail_part
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue