I've released a small update to Lurgle.Alerting which adds automatic determination of the attachment content type using the MimeMapping library. I've raised the version to v1.2.0 to align with Lurgle.Logging's current releases.
This specifically addresses an issue when sending attachments with MailKit as the SMTP sender. The FluentEmail implementation was essentially causing a
System.ArgumentNullException exception in
MimeKit.Utils.ParseUtils.ValidateArguments, because content type defaults to null. With the old SmtpClient, that was okay, but FluentEmail was explicitly trying to parse a null content type and receiving the error.
The aforementioned MimeMapping project on Nuget had an extensive set of mime types and provided a straightforward way to perform a 'best effort' match based on file name, with a sensible default of application/octet-stream. Perfect.
As a result - Lurgle.Alerting will always supply a valid mime type to the underlying SMTP sender if you don't pass one. If you do pass a content type and it's invalid, we don't attempt to validate that at this point - so you will likely get an exception.
As per normal, update from Nuget, or via the oh-so-fancy links below.