New: Replace SmtpClient with Mailkit

Closes #723
pull/1092/head
bakerboy448 3 years ago committed by Qstick
parent 811c84a845
commit eb26b38f2c

@ -14,6 +14,7 @@
<PackageVersion Include="Ical.Net" Version="4.2.0" />
<PackageVersion Include="ImpromptuInterface" Version="7.0.1" />
<PackageVersion Include="Kveer.XmlRPC" Version="1.1.1" />
<PackageVersion Include="Mailkit" Version="2.10.1" />
<PackageVersion Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.7" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Notifications.Email
var paths = Settings.AttachFiles ? message.BookFiles.SelectList(a => a.Path) : null;
SendEmail(Settings, BOOK_DOWNLOADED_TITLE_BRANDED, body, paths);
SendEmail(Settings, BOOK_DOWNLOADED_TITLE_BRANDED, body, false, paths);
}
public override void OnHealthIssue(HealthCheck.HealthCheck message)
@ -95,16 +95,21 @@ namespace NzbDrone.Core.Notifications.Email
Text = body
};
_logger.Debug("Sending email Subject: {0}", subject);
if (attachmentUrls != null)
{
var builder = new BodyBuilder();
builder.HtmlBody = body;
foreach (var url in attachmentUrls)
{
email.Attachments.Add(new Attachment(url));
byte[] bytes = System.IO.File.ReadAllBytes(url);
builder.Attachments.Add(url, bytes);
_logger.Trace("Attaching: {0}", url);
}
email.Body = builder.ToMessageBody();
}
_logger.Debug("Sending email Subject: {0}", subject);
try
{
Send(email, settings);

@ -13,6 +13,7 @@
<PackageReference Include="FluentMigrator.Runner" />
<PackageReference Include="FluentMigrator.Runner.SQLite" />
<PackageReference Include="FluentValidation" />
<PackageReference Include="MailKit" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NLog" />
<PackageReference Include="RestSharp" />

Loading…
Cancel
Save