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.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
|
||||||
|
|
Loading…
Reference in a new issue