gpt4 book ai didi

asp.net - 邮箱不可用错误

转载 作者:行者123 更新时间:2023-12-04 13:10:08 25 4
gpt4 key购买 nike

尝试在 .NET 站点中发送电子邮件时,遇到以下错误:

Mailbox unavailable. The server response was: No such user here

如果代码试图发送到不存在的电子邮件地址,是否会出现此错误?

谢谢。

我现在有关于这个错误的更多信息。电子邮件是从“noreply@[domain]”发送的。当电子邮件发送到同一域的电子邮件地址时,电子邮件发送没有问题。仅当发送到的电子邮件地址不是来自同一域时才会出现此错误。不知道有没有用?

最佳答案

当您使用 NetworkCredentials 指定域时会发生这种情况.如果您指定域(第三个参数),那么您只能发送到该域内的有效邮箱。保留它以便能够发送到域外的任何地址。

var client = new SmtpClient("smtp.server.com");
client.UseDefaultCredentials = false;

// The following will be able to send to anyone outside the domain.
client.Credentials = new NetworkCredential("user", "password");

// The following will only work when sending to users on server.com
client.Credentials = new NetworkCredential("user", "password", "server.com");

关于asp.net - 邮箱不可用错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4157428/

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