2014-07-16 131 views
0

我正在写一个应用程序,当数据出现问题时将电子邮件发送给管理员。它发送的帐户是Network Solutions SMTP服务器。间歇性“传输失败连接到服务器”CDO错误

该代码大部分时间工作,但大约有十分之一发送失败,错误为-2147220973“传输无法连接到服务器”。

有关如何处理此问题的任何建议?

Set imsg = CreateObject("cdo.message") 
Set iconf = CreateObject("cdo.configuration") 
Set Flds = iconf.Fields 

With Flds 
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.OurCompany.com" 
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic 
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 2525 
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]" 
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password" 
    .Update 
End With 

With imsg 
    Set .Configuration = iconf 
    .To = "[email protected]" 'CMemail 
    .From = "[email protected]" 

    .Subject = ACT 
    .HTMLBody = "Notification for " & CTName & " of " & CTCname & " " & ACT & ". You must manually Notify them about new docs for " & pname & ". " _ 
      & "<br>Tell " & CTName & " to '" & Nz(DLookup("Notify", "TBLINVOICESETTINGS"), "") & " " & PRName & "_" & pname & ".pdf'" 

    .Send 
End With 

Set imsg = Nothing 
Set iconf = Nothing 
+0

猜测我只会捕获该错误并恢复到错误不再出现。 – Barry

回答

0

如果smtpserverport是25,它是否被防火墙阻止?

+0

不,不是。我相信我通过错误陷阱和重试缓解了它。 – Barry

+0

我们的pop服务器由Network Solutions管理。 2525是他们使用的端口。 – Barry

相关问题