问题标签 [mimekit]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
465 浏览

c# - Mimekit 在验证时安装证书

MimeKit用来验证 SMIME 多部分签名消息是否由特定实体签名。我有这个实体的公共证书。调用对象Verify(context)MultipartSigned,证书被导入到服务器证书列表中。我想要的是,如果找不到证书,则会出现此错误。否则,如果恶意用户签署文件,它将通过,更糟糕的是,我最终会安装他的证书。

我的推理在这里有缺陷吗?

这是我正在使用的代码。

0 投票
1 回答
2553 浏览

c# - MimeKit 字符编码/解码问题

在使用MimeKit.eml文件转换为.msg文件时,我遇到了一个似乎与编码有关的问题。

例如,使用包含以下内容的 EML 文件:

结果是正文内容中的垃圾:

此外,读取 EML 文件时ü会显示base-64 编码字符。??我已经下载了最新版本的 MimeKit,但似乎并没有什么不同。

.eml 文件可以使用 Outlook 2016 正确打开,但使用 MimeKit 似乎无法正确读取和解码文件。

0 投票
1 回答
783 浏览

c# - 使用 Mimekit 发送到包含特殊字符的电子邮件地址

我正在尝试向电子邮件地址发送电子邮件:coordinación@test.xxxxx.com,其中包含通过启用了SMTPUTF8扩展的邮件服务器使用 Mailkit 的特殊字符(通过从 shell 发送示例测试电子邮件进行了双重检查脚本)。

Mailkit 将异常报告为“SMTP 服务器不支持 SMTPUTF8 扩展”,我应该做些什么来对电子邮件地址进行不同的编码吗?

我曾尝试对 MailboxAddress 构造函数使用 UTF-8 编码,但结果是相同的。请找到相同的协议日志。

编辑:如果我使用 Mailkit 1.1.4(感谢 Jeff 的快速补丁),这对我来说不再是问题,显然一些邮件服务器即使没有启用 SMTPUTF8 扩展也可以发送 UTF 邮件,即奇怪的。

0 投票
1 回答
12615 浏览

c# - MailKit:如何从 MimeMessage 本地下载所有附件

我在网上查看了其他示例,但我无法弄清楚如何从 MimeMessage 对象下载和存储所有附件。我确实查看了 WriteTo(),但我无法让它工作。还想知道附件是否会按照原文件名保存,并在邮件中输入。这是我到目前为止所拥有的:

0 投票
1 回答
1628 浏览

c# - 检查 .net 核心中动态加载的库的依赖关系

我正在尝试创建使用外部 dll-s 中的某些功能的插件。因为我不知道将使用哪个插件,所以我想动态加载:

  1. 主要的 asp.net 核心项目,它使用反射动态加载诸如 mailservice.dll 之类的插件。

  2. 公开 CheckMail() 方法的 mailservice.dll 库(我使用 MimeKit 作为 IMAP 助手)。

一切正常,但是当我调用 CheckMail() 方法时,我收到System.IO.FileNotFoundException: Could not load file or assembly 'MailKit, Version=1.16.0.0。所以我把从发布版本中提取的 MimeKit 的所有依赖项都放在了,但仍然没有(46 个文件)。当我使用 nuget 将 MimeKit 包安装到我的主 asp.net 项目时,一切运行正常,但显然我不想保持这种依赖关系。

是否有任何工具或技术来检查缺少哪个文件?

0 投票
2 回答
593 浏览

c# - HTML looks okay in browser but not in email

I'm having some trouble with email encoding. I am reading an HTML file from disk and sending in through Gmail. When I open the HTML in the browser it looks great. When I copy the HTML string from Visual Studio and save it as an HTML file, it looks great. When I receive the email it contains a bunch of invalid characters. Even the list bullets are messed up! I'm sure this is an issue with encoding, but the file is encoded as UTF-8 and looks good until it's converted to RAW and sent through Gmail.

Here is the process. We read from a docx using the OpenXML SDK then we use the HtmlConverter to save the document as HTML. Later the HTML is read in from the file, converted to RAW formatting and sent through the GMail API.

Here are some relevant code snips:

This is where we save our HTML file using HtmlConverter.

This is where we read the stored HTMl and convert it for sending via Gmail. (We use Mimekit for the conversion.)

And this is how we are base64 encoding:

The email ends up as "Content-Type: multipart/mixed" with two alternatives. One is

and the other is

The both the plain text and the HTML contain strings like =C3=A2=E2=82=AC=E2=84=A2 for an apostrophe and the HTML portion contains an HTML header that contains weird "3D" characters in it.

None of this weirdness was in the HTML prior to converting to Base64 and sending.

Any ideas what the problem could be? Does this have anything to do with UTF8 and Mimekit?

0 投票
1 回答
627 浏览

c# - MimeKit 使用 AES 加密消息

我想要 du 加密并使用 MimeKit 签署邮件。

生成消息的工作原理:

在 Outlook 中,它们通过以下方式加密:168 位 3DES 但我需要 AES 265。我该如何管理?

我可以将签名设置为 RSA/SHA512

但不是加密。

编辑:更新到我的解决方案

0 投票
2 回答
2109 浏览

c# - 在发送带有附件的电子邮件时,我应该处理 MimeKit 使用的流吗?

我在玩 MailKit/MimeKit,有些东西困扰着我。我想使用流发送带有附件的电子邮件。MimeKit 提供的BodyBuilder类使得创建正文消息和附加文件变得非常容易:

我在代码的其他地方生成流并且我没有关闭它,所以我可以将它传递给 MimeKit。不清楚的是:MimeKit 是否处理流?基本上(据我所知)消费者通常负责处理 Streams。我也知道在 MemoryStream (我基本上正在使用)上调用 dispose 不会释放任何资源..但会阻止读取/写入它。但是,如果将来实现更改为另一种类型的 Stream,事情会变得更加复杂。

我还深入研究了 MikeKit 源代码,发现传入的 StreamAttachmentCollection.Add被“添加”到了MemoryBlockStream从 Stream 继承的 a 中(并实现了 Dispose),所以我假设它被释放了,但在这一点上,我只是猜测。

有任何想法吗?

0 投票
2 回答
262 浏览

mimekit - 如何在空闲循环中正确使用 CountChanged

我应该如何在空闲循环中使用 CountChanged 事件中的 Fetch?我看到了演示,其中有一条取消空闲循环的注释。

但是,如果我这样做 -

Fetch 将在任何 MessageExpunge 事件之后异步执行。这可能会弄乱可能期望 CountChange 已经更新本地缓存索引的本地索引。

  • 4 删除
  • 3 EXISTS - 这里的 CountChange 事件可以在下面 * 3 EXPUNGE 之后执行,这会弄乱索引
  • 3 删除

请指教?

0 投票
1 回答
3227 浏览

c# - 使用 mimekit/mailkit 库获取电子邮件的发送状态

我正在使用@jstedfast Mimekit/Mailkit 库,用于从我的应用程序发送大量电子邮件。我想知道如何获取每封电子邮件的发送状态。这是我第一次尝试得到这个,在一些 RnD 之后,我知道我们必须在某个地方设置或传递 report-type=delivery-status,但我不知道在我读到这个的文档中在哪里做这个. 我也尝试覆盖 DeliveryStatusNotification,但一无所获。可能是我在错误的方向上获取通知/状态。

我知道@jstedfast 在这里很活跃。我需要你的帮助。我没有得到任何指示来做这件事。提前致谢。