Using these lines in my script
Add-Type -Path "C:\Program Files\PackageManagement\NuGet\Packages\Portable.BouncyCastle.1.8.10\lib\netstandard2.0\BouncyCastle.Crypto.dll"
Add-Type -Path "C:\Program Files\PackageManagement\NuGet\Packages\system.buffers\4.5.1\lib\netstandard2.0\System.Buffers.dll"
Add-Type -Path "C:\Program Files\PackageManagement\NuGet\Packages\mimekit\2.15.0\lib\netstandard2.0\MimeKit.dll"
Add-Type -Path "C:\Program Files\PackageManagement\NuGet\Packages\mailkit\2.15.0\lib\netstandard2.0\MailKit.dll"
This works in VS Code, and on one server it works directly in PS. But on another server I get this error:
Exception calling “Send” with “1” argument(s): “Could not load file or assembly ‘System.Buffers, Version=4.0.2.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ or one of its dependencies. The system cannot find the file
specified.”