我遇到了一个较旧的经典ASP应用程序的问题,其中在代码中使用了读取收据。此特定例程已成功使用多年,但最近我们已迁移到使用Windows 2008 r2,IIS 7.5和SmarterMail 11.07客户端的新服务器。现在,只要应用程序尝试发送服务器生成的电子邮件,SmarterMail日志就会显示它已成功接收并验证提交,但似乎无故终止或中止连接,并且不会在没有任何错误的情况下发送电子邮件。我在这里不知所措,因为就像我说的那样,这个例程已经有一段时间没有问题了,如果我们不在ASP应用程序中选择“读取收据”选项,那么电子邮件分发就好了。我已经在下面包含了一个缩短版本的代码,并主要寻找验证,所有预期目的的代码应该按原样运行,如果有人知道SmarterMail本身内部与此相关的类似问题,就像某种默认安全设置我是不知道。顺便说一句,如果我们手动使用SmarterMail webmail界面,我们可以成功发送带有阅读回执的邮件,所以我知道它应该是可能的。 - 谢天谢地!
set Mail = Server.CreateObject("CDO.Message")
'Basic configuration
Mail.AutoGenerateTextBody = 0
Mail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strHost
Mail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Mail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = strPort
Mail.Configuration.Fields.Update
Mail.Fields("urn:schemas:mailheader:X-Mailer") = "Custom EMailer"
Mail.Fields.update
'Priority
Mail.Fields("urn:schemas:mailheader:X-Priority") = emPriority
Mail.Fields("urn:schemas:mailheader:X-MSMail-Priority") = emPriorityTxt
Mail.Fields("urn:schemas:httpmail:importance") = emPriority
Mail.Fields.update
'Addressing
With Mail
.From = strFrom
.ReplyTo = strReplyTo
.To = strTo
.CC = strCc
.BCC = strBCc
End With
'Attachments
if len(sfls) > 0 then
if instr(1,sfls,",",1) > 0 then
strAttachments = split(sfls,",",-1,1)
else
strAttachments = sfls
end if
if isarray(strAttachments) then
for x = 0 to ubound(strAttachments)
Mail.AddAttachment strAttachments(x)
next
else
Mail.AddAttachment strAttachments
end if
end if
'Body
Mail.Subject = strSubject
if isHTML then
Mail.HTMLBody = strBody
else
Mail.TextBody = strBodyTxt
end if
'###################################################################
'If this section is included the email will not send, times out or
'connection is terminated, according to the SmarterMail logs
'###################################################################
' Read/Delivery Receipt
if isRead then
Mail.Fields("urn:schemas:mailheader:disposition-notification-to") = rrReplyTo
Mail.Fields("urn:schemas:mailheader:return-receipt-to") = rrReplyTo
Mail.DSNOptions = 14
Mail.Fields.Update
end if
'###################################################################
'Send Message
strErr = ""
bSuccess = False
On Error Resume Next
Mail.Send
If Err <> 0 Then
strErr = Err.Description
else
bSuccess = True
End If
set Mail = nothing
=============================================== =============