Throw a SMTP exception when the body is blank in a received message

This commit is contained in:
Patrick Gansterer 2020-02-18 19:46:48 +01:00
parent 7f375baf49
commit 42e0ce86a8

View file

@ -35,6 +35,10 @@ class MessagesMailReceiver
body.encode!(Encoding::default_internal) body.encode!(Encoding::default_internal)
body = EmailReplyTrimmer.trim(body) 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
message = @user.send_messages.new body: body, message = @user.send_messages.new body: body,
group: @message.group, group: @message.group,
private: @message.private, private: @message.private,