如何在 Powershell 中安装 Mailkit

问题描述

我好像在绕圈子……

我尝试了 Install-Package -Name 'MailKit' -Source 'nuget.org' 但它无法找到包源 nuget.org

我尝试从下载进行本地安装,它只是不断询问依赖包,例如 System.Buffers,然后是 Portable.BouncyCastle 安装但随后遵循 System.Security.Cryptography.Pkcs,最后指出“检测到依赖循环用于包装"

是否有人能够提供安装 MailKit 以与 Powershell 一起使用的途径,或提供从 Powershell 发送电子邮件的替代方法

我只需要从脚本中偶尔发送一封通知邮件(每天 1 封??),但 SendMail 不断发出不应使用的警告并且已经过时。

解决方法

在发布问题并阅读更多主题后,我尝试了这些似乎有效的命令,尽管我不确定是否缺少任何相关的依赖项:

Install-Package -Name 'MimeKit' -Source "https://www.nuget.org/api/v2" -SkipDependencies

然后

Install-Package -Name 'MailKit' -Source "https://www.nuget.org/api/v2"