1

I've added Microsoft.NETCore.Portable.Compatibility NuGet to my Project, but I still cannot using System.Net.Mail;

I want to send mails via smtp. I've tried to add assembly reference System.dll. In that case it was possible to use System.Net.Mail but then I've got errors in MailMessage mail = new MailMessage(); mail.To.Add(receiver); and SmtpClient smtp = new SmtpClient(); smtp.Credentials = true; It said that mscorlib is missing.

I've searched around the whole night but did not found any solution.

It is confusing why it does not work with Microsoft.NETCore.Portable.Compatibility because that includes System.dll as well. Do I need to setup something after installing via NuGet?

Neneil
  • 105
  • 12
  • 2
    I'd suggest using `MailKit` instead. SMTP wasn't supported in dotnet core up until 2.0 so upgrade to that if you're lower, or try `Mailkit` instead. – thisextendsthat Nov 03 '17 at 12:18

1 Answers1

0

Try this for send mail: How to send email in ASP.NET C#

Try this for missing mscorlib (maybe try import to dependencies): What does mscorlib stand for?

Or: https://developercommunity.visualstudio.com/content/problem/22337/have-problem-with-assembly-mscorlib.html

Frantisek Pastorek
  • 508
  • 1
  • 8
  • 26