c# - C# - Linux 上的 SMTP 邮件发送不起作用
问题描述
我的程序在 debian 10 Linux 服务器上运行。
我在我的 C# 程序中使用了一个名为 EASendMail 的包,但它也不适用于普通的 System.Net.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!");
每次我在 linux 上启动我的程序时dotnet run
,整个 porgram 都能完美运行。如果它来做 smtp 部分,则会出现此错误: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
我知道 kernel32.dll 仅适用于 Windows,但有什么解决方法吗?
提前致谢!!
解决方案
推荐阅读
- javascript - 将 webpack 与 react 一起使用时出现错误
- php - 使用 json 编码的 php 数组中的 Google 图表
- ios - NavigationController 在以编程方式呈现后在 Swift 中为零
- javascript - React Native - 数组对象到 AsyncStorage
- c++ - 如何通过 libcurl 通过 https 下载数据?
- php - PHPMailer通过ajax发送邮件
- python-3.x - 404 使用烧瓶时未找到错误
- c++ - C++ 在 Linux 上编写 UTF-8
- google-sheets - 获取两个系列中匹配数字的计数
- php - 如何在一个操作中使 httpcache 无效?