This project has moved and is read-only. For the latest updates, please go here.
1
Vote

If email is not Mime it all falls over

description

220 myMachine
helo
250 myMachine
mail from:me@mydomain.com 250 me@mydomain.com OK
rcpt to:you@yourdomain.com 250 you@yourdomain.com OK
data
354 Start mail input; end with <CRLF>.<CRLF>
Bit of non-mine text
.
250 OK

This shows nothing in Papercut as the ReceivedMessageHandler.cs falls over when trying to load it. It is not mime so message = MimeMessage.Load(ParserOptions.Default, ms, true); fails.

Fix is easy:-

Change var message = MimeMessage.Load(ParserOptions.Default, ms, true);

To

MimeMessage message;
try
{
message = MimeMessage.Load(ParserOptions.Default, ms, true);
}
catch
{
message = new MimeMessage();
message.Body = new TextPart("plain") { Text = messageData };
}



Not fully tested and code is a bit raw, but fix works for me :-)

Papercut rocks! :-)

comments