POP 优先于 SMTP

发布于 2024-07-08 13:42:29 字数 500 浏览 5 评论 0原文

最近,我不得不将我的一个 Web 应用程序迁移到新的托管提供商。 邮件和网络服务仍然保留在旧的托管站点上,但是,当我尝试从新服务器发送电子邮件时,我收到错误;

“服务器拒绝了一个或多个收件人地址。服务器响应是:

450 <email_address>: Recipient address rejected: Greylisted for 5 minutes

我询问我的旧托管提供商我需要做什么来解决此问题,他们回复为

邮件服务器之前运行在POP上 SMTP。 如果没有有效的 POP 登录 发送邮件之前收到 服务器,那么邮件是 列入灰名单并保留 5 分钟 重试之前。

要防止这种情况,只需执行 Receive 发送邮件之前

有人知道如何在 C# 中在 SMTP 之前执行 POP 吗?

Recently I had to move one of my web applications to a new hosting provider. The mail and web service is still held on the old hosting site however, when I try to send an email from the new server,I get an error;

"The server rejected one or more recipient addresses. The server response was:

450 <email_address>: Recipient address rejected: Greylisted for 5 minutes

I asked my old hosting provider what I need to do to fix this and they replied with

The mail server operates on POP before
SMTP. If a valid POP login is not
received before sending mail through
the server, then the mail is
greylisted and held for 5 minutes
before a retry.

To prevent this, simply do a Receive
before sending mail

Does anyone have any idea how I do a POP before SMTP in C#?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

与酒说心事 2024-07-15 13:42:29

我不确定 C# 将如何处理具体细节(套接字?),但基本上您只想与新的 POP 服务器建立连接。 下面是一个 POP 事务示例:

$ telnet new-pop-server.com 110
Connected to new-pop-server.com.
Escape character is '^]'.
+OK
USER <username>
+OK 
PASS <password>
+OK               // you're authenticated at this point 
LIST
+OK 
.                 // no new messages!
QUIT
+OK 

一旦您获得授权,您应该能够以编程方式发送邮件。 (USER、PASS、LIST、QUIT)都是您要发送的命令(pop3 RFC )。

i'm not sure how C# would handle the specifics (sockets?), but basically you just want to make a connection to your new POP server. here's a sample POP transaction:

$ telnet new-pop-server.com 110
Connected to new-pop-server.com.
Escape character is '^]'.
+OK
USER <username>
+OK 
PASS <password>
+OK               // you're authenticated at this point 
LIST
+OK 
.                 // no new messages!
QUIT
+OK 

once you're authorized you should be able to send your mail programatically. (USER, PASS, LIST, QUIT) are all commands you would send (pop3 RFC).

寂寞笑我太脆弱 2024-07-15 13:42:29

他们将您列入灰名单,因为您是从新提供商连接的,对吧? 新的提供商没有允许来自服务器 IP 范围的连接的 SMTP 吗?

另一种方法是自己进行 MX 查找,并直接连接到您要向其发送电子邮件的地址的权威 SMTP 服务器。 但是,这还要求您处理灰名单,即重试 4xx 响应以获得可靠的交付。

也许您应该询问您的提供商是否也提供身份验证 SMTP 作为替代方案,这是另一个可能的故障点,因为在使用 SMTP 服务之前需要 POP 登录。

They greylist you because you connect from your new provider, right? Doesn't the new provider have a SMTP which allows connections from the servers IP-range?

Another approach is to do the MX-lookup yourself, and connect directly to the authoritive SMTP-server for which address you're sending email to. However, that also requires you to handle greylisting, meaning, retries on 4xx responses in order to have a reliable delivery.

Maybe you should ask your provider if they provide auth SMTP as an alternative aswell, it's kind of another possible point of failure with the need of POP-login before using the SMTP-service.

花辞树 2024-07-15 13:42:29

我很确定 POP3 没有内置到 .NET Framework 中,因此您需要按照 Owen 建议自行实现它,或者查找现有的 POP3 库,例如 这个

更好的是说服您的新托管提供商放宽灰名单规则。

I'm pretty sure POP3 is not built into the .NET Framework, so you'll need to implement it yourself as Owen suggested or look for an existing POP3 library such as this one.

Even better would be convincing your new hosting provider to relax that greylisting rule.

眼眸 2024-07-15 13:42:29

我设法为此编写了代码。 我愿意分享解决方案(如果有人感兴趣?),但不确定如何最好地将代码放在 Stackoverflow 上? 大约有 50 行代码。

I managed to write the code for this. I am willing to share the solution, (if anyone is interested?) but not sure how best to put the code on Stackoverflow? It's about 50 lines of code.

虚拟世界 2024-07-15 13:42:29

按照建议,我将代码添加到我的博客中。 这不是有史以来最好的博客,但是,有人可能会发现它有用......
POP-Before-SMTP

As suggested I added the code to my blog. It's not the best blog ever published but, someone may find it useful...
POP-Before-SMTP

烟织青萝梦 2024-07-15 13:42:29

您已经有了您正在寻找的代码,但如果我可以添加我的想法:就像其他人已经建议的那样,我会与旧提供商核实他们是否提供带有 SMTP 的身份验证。 对我来说,他们的意思是,“只有当您来自相同的 IP 范围/子网,或者您已经通过身份验证时,您才能使用 SMTP”。 许多 ISP 通过其 SMTP 服务器执行此操作。 如果您通过特定 ISP 连接,则可以使用 SMTP,而无需显式提供任何 AUTH 凭据。 如果您切换到另一个 ISP 并希望使用旧 ISP 的 SMTP,则必须通过 SMTP 服务器显式进行身份验证。

You already have the code you're looking for, but if I may add in my thoughts: Like someone else already suggested, I would check with the old provider whether they provide AUTH with SMTP. To me, what they are saying is that, "You can use SMTP only if you are coming from the same IP range/subnet, or if you have authenticated yourself". A lot of ISPs do this with their SMTP servers. If you are connected through a particular ISP, you can use the SMTP without providing any AUTH credentials explicitly. If you switch to another ISP and want to use the old ISP's SMTP, you'll have to explicitly authenticate with the SMTP server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文