0

My Program runs on an debian 10 Linux Server.

I used a package in my C# programm called EASendMail but it doesn't work with the normal System.Net.Mail aswell.

This is my code snippet I use for sending a mail

SmtpMail oMail = new SmtpMail("mykey");

                oMail.From = fromEmail;
                oMail.To = toEmail;

                oMail.Subject = "Subject";
                oMail.TextBody = "Body";

                SmtpServer oServer = new SmtpServer(exchange);
                oServer.User = email;
                oServer.Password = pass;
                oServer.Port = 25;
                

                Console.WriteLine("start to send email ...");

                SmtpClient oSmtp = new SmtpClient();
                oSmtp.SendMail(oServer, oMail); 

                Console.WriteLine("email was sent successfully!");

Everytime I start my program on linux with dotnet run the whole porgram runs perfectly. If it comes do the smtp part this error appears: Unable to load shared library 'kernel32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libkernel32.dll: cannot open shared object file: No such file or directory

I understand that kernel32.dll is only for windows but is there any fix to this?

Thanks in advance!!

Timebreaker900
  • 312
  • 2
  • 7
  • 21
  • FWIW [SmtpClient is obsolete](https://learn.microsoft.com/en-us/dotnet/api/system.net.mail.smtpclient?view=net-5.0) now, and you should probably use something like MailKit instead. – ProgrammingLlama Dec 09 '20 at 13:54
  • I think I've tried MailKit in the past. Didn't it also use smtpclient? – Timebreaker900 Dec 09 '20 at 14:01
  • 1
    It does: [MailKit's `SmtpClient`](http://www.mimekit.net/docs/html/T_MailKit_Net_Smtp_SmtpClient.htm), which is a completely different implementation to the .NET one. – ProgrammingLlama Dec 09 '20 at 14:05
  • Read the remarks in John's link. It is only obsolete is specific versions of Net especially Xamarin – jdweng Dec 09 '20 at 15:10
  • Hmm.. My project is a core.net project. It works in localhost. But if i start it on Linux the error appears. – Timebreaker900 Dec 09 '20 at 15:29
  • @jdweng Oh. Interesting. It wasn't there when I switched my projects to .NET Core (back in 1.1), so I assumed they'd done away with it. – ProgrammingLlama Dec 09 '20 at 15:53

0 Answers0