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
1 changed files with 4 additions and 0 deletions

View File

@ -35,6 +35,10 @@ 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
message = @user.send_messages.new body: body,
group: @message.group,
private: @message.private,