gpt4 book ai didi

c# - MailKit SMTPUTF8 错误

转载 作者:太空宇宙 更新时间:2023-11-03 21:14:13 25 4
gpt4 key购买 nike

我同时使用 MimeKit 和 MailKit 通过 SMTP 服务器发送电子邮件。不过,时不时地,我的服务器会向我返回一个错误:

The SMTP server does not support the SMTPUTF8 extension

显然,我想阻止这些错误的发生。 MimeKit 中有没有办法在 SmtpClient、MimeMessage 或 MimeEntity 上禁用 SMTPUTF8 扩展?

我担心我问错了问题,或者在错误的地方寻求解决方案。如果有人可以对可能措辞不佳的问题进行澄清,请告诉我。

这是我发送的方式:

using (var client = new SmtpClient())
{
try
{
client.Connect("server", port);
// I've got reasons to remove this.
client.AuthenticationMechanisms.Remove("XOAUTH2");
client.Send(message);
client.Disconnect(true);
}
catch (Exception e)
{
// Pokemon Exception handling right here
// for the sake of showing what I'm doing.
}
}

最佳答案

您的收件人(或发件人)列表中的一个或多个电子邮件地址具有 unicode 地址(我不是说“显示名称”包含 unicode 字符,我的意思是“x@y.com "部分包含需要 SMTP 服务器支持 SMTPUTF8 扩展才能工作的 unicode 字符。

例如,您可能试图发送到诸如 日本​​语@日本语.jp 之类的电子邮件地址。请注意,传统上,只允许使用基于 ASCII 的电子邮件地址,不支持 SMTPUTF8 扩展的 SMTP 服务器无法处理非 ASCII 的电子邮件地址。

关于c# - MailKit SMTPUTF8 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35557307/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com