“SMTP传入数据超时” 在 Windows XP 中使用 Indy 10 发送包含内嵌图像的电子邮件时

发布于 2024-07-17 07:17:41 字数 2046 浏览 4 评论 0原文

出现错误“SMTP 传入数据超时”,我使用 Indy 10 的 tiburon 分支和以下代码来发送带有内联图像的电子邮件:

   MB := TIdMessageBuilderHtml.Create;
    try
      MB.PlainText.Assign(Text);
      MB.Html.Assign(FHTML);
      MB.HtmlFiles.Add('c:\Path\to\My\Image.jpg');
      MB.FillMessage(IdMessage);
    finally
      MB.Free;
    end;


  if not IdSMTP.Connected then
    IdSMTP.Connect;
  IdSMTP.Send(IdMessage);

当我尝试在 Windows XP 中发送带有内联图像的电子邮件时, 在 Windows XP 中,在 Windows Vista 中,电子邮件和内嵌图像发送得很好。

显然它没有向服务器发送任何内容,它似乎在发送之前卡住了图像编码。

这是调用堆栈:

 IdReplySMTP        497   +1 TIdReplySMTP.RaiseReplyError
 IdTCPConnection    574   +1 TIdTCPConnection.RaiseExceptionForLastCmdResult
 IdTCPConnection    724  +10 TIdTCPConnection.CheckResponse
 IdTCPConnection    563   +2 TIdTCPConnection.GetResponse
 IdTCPConnection    583   +4 TIdTCPConnection.SendCmd
 IdTCPConnection    696   +4 TIdTCPConnection.SendCmd
 IdSMTP             377   +2 TIdSMTP.DisconnectNotifyPeer
 IdTCPConnection    517   +5 TIdTCPConnection.Disconnect
 IdSMTP             476   +2 TIdSMTP.Disconnect
 IdTCPConnection    828   +2 TIdTCPConnection.Disconnect
 Email              130  +11 TEmail.Destroy
 System            9806   +1 TObject.Free
 EnviarEmail        322  +38 TFormEnviarEmail.Enviar
 System           12106  +38 @HandleFinally
                             RtlUnwind
 System           11589  +83 @HandleAnyException
                             KiUserExceptionDispatcher
                             RtlAppendUnicodeToString
 IdMessageClient    873   +4 EncodeAttachment
 IdMessageClient   1213 +252 TIdMessageClient.SendBody
 IdMessageClient   1244 +283 TIdMessageClient.SendBody
 IdMessageClient   1269  +12 TIdMessageClient.SendMsg
 IdSMTPBase         251   +6 TIdSMTPBase.SendNoPipelining
 IdSMTPBase         436   +4 TIdSMTPBase.InternalSend
 IdSMTPBase         457   +1 TIdSMTPBase.Send
 IdSMTP             415   +6 TIdSMTP.Send
 IdSMTPBase         449   +6 TIdSMTPBase.Send

有关导致此问题的原因以及如何解决问题的任何线索吗?

谢谢。

I'm getting the error "SMTP incoming data timeout" when I try to send an email with inline images in Windows XP, I'm using the tiburon branch of Indy 10 with the following code to send emails with inline images:

   MB := TIdMessageBuilderHtml.Create;
    try
      MB.PlainText.Assign(Text);
      MB.Html.Assign(FHTML);
      MB.HtmlFiles.Add('c:\Path\to\My\Image.jpg');
      MB.FillMessage(IdMessage);
    finally
      MB.Free;
    end;


  if not IdSMTP.Connected then
    IdSMTP.Connect;
  IdSMTP.Send(IdMessage);

It just happens in Windows XP, in Windows Vista the email and the inline image are sent just fine.

Apparently it isn't sending anything to the server, it appears to become stuck enconding the image before sending.

Here is the call stack:

 IdReplySMTP        497   +1 TIdReplySMTP.RaiseReplyError
 IdTCPConnection    574   +1 TIdTCPConnection.RaiseExceptionForLastCmdResult
 IdTCPConnection    724  +10 TIdTCPConnection.CheckResponse
 IdTCPConnection    563   +2 TIdTCPConnection.GetResponse
 IdTCPConnection    583   +4 TIdTCPConnection.SendCmd
 IdTCPConnection    696   +4 TIdTCPConnection.SendCmd
 IdSMTP             377   +2 TIdSMTP.DisconnectNotifyPeer
 IdTCPConnection    517   +5 TIdTCPConnection.Disconnect
 IdSMTP             476   +2 TIdSMTP.Disconnect
 IdTCPConnection    828   +2 TIdTCPConnection.Disconnect
 Email              130  +11 TEmail.Destroy
 System            9806   +1 TObject.Free
 EnviarEmail        322  +38 TFormEnviarEmail.Enviar
 System           12106  +38 @HandleFinally
                             RtlUnwind
 System           11589  +83 @HandleAnyException
                             KiUserExceptionDispatcher
                             RtlAppendUnicodeToString
 IdMessageClient    873   +4 EncodeAttachment
 IdMessageClient   1213 +252 TIdMessageClient.SendBody
 IdMessageClient   1244 +283 TIdMessageClient.SendBody
 IdMessageClient   1269  +12 TIdMessageClient.SendMsg
 IdSMTPBase         251   +6 TIdSMTPBase.SendNoPipelining
 IdSMTPBase         436   +4 TIdSMTPBase.InternalSend
 IdSMTPBase         457   +1 TIdSMTPBase.Send
 IdSMTP             415   +6 TIdSMTP.Send
 IdSMTPBase         449   +6 TIdSMTPBase.Send

Any clues about what is causing it and how can I solve the problem?

Thanks.

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

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

发布评论

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

评论(3

蝶…霜飞 2024-07-24 07:17:41

您是否确认可以使用真正的邮件客户端发送相同的邮件,最好是简单且便携且不集成到系统内部的客户端,例如 Mozilla Thunderbird 或 Opera 附带的邮件客户端? 那里可能有防病毒/反垃圾邮件/反任何系统干扰 - 其中许多系统透明地拦截传出的 25/TCP 并对数据进行处理。

Have you confirmed you can send the same mail with a bona fide mail client, preferably a simple and portable one which doesn't integrate into the bowels of the system, like Mozilla Thunderbird or Opera's included mail client? There could be an antivirus / antispam / antiwhatever system interfering there - many of those transparently intercept outgoing 25/TCP and do stuff to the data.

无法言说的痛 2024-07-24 07:17:41

如果编码不是原因,而是读取超时,您可以使用 ReadTimeOut 属性增加它:

IdSMTP1.ReadTimeOut := 20000;

If the encoding is not the reason, but a read time out, you could increase it using the ReadTimeOut property:

IdSMTP1.ReadTimeOut := 20000;

司马昭之心 2024-07-24 07:17:41

问题解决了。

我正在解析一个 HTML 文件来加载图像并将它们附加在电子邮件中,但在 Windows XP 中,路径是:

C:\Documents And Settings\User\Desktop\....

在 html 文件中,此路径是

C:\Documents%20And%20Settings\User\Desktop\....

因此内部引发了文件未找到异常并停止该过程,直到超时,Indy 没有加注。

在 Windows XP 计算机上运行的进程中附加远程调试器后,我在第一次尝试时遇到了异常。

我认为印地“吞没”例外是不正确的,但那是另一段历史了。

Problem solved.

I'm parsing an HTML file to load the images and attach them in the email, but in windows XP the path is:

C:\Documents And Settings\User\Desktop\....

And in the html file this path was

C:\Documents%20And%20Settings\User\Desktop\....

So a File not Found exception was being raised internally and stopping the process, till timeout, and Indy wasn't raising it.

After attaching a remote debugger in the process running on the Windows XP machine I got the exception in the first try.

I don't think its correct for Indy to "engulf" the exception, but that's another history.

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