在我们现有的平台上,我们决定将我们的开发服务器从Windows Server 2003升级到2008年。
我们面临的问题是,在我们使用Windows Server 2003之前,所有用于发送电子邮件的asp脚本都可以运行。现在,他们停止工作,页面或SMTP日志上没有错误。
如果我使用telnet手动发送电子邮件可以正常工作。
但它不适用于我们的经典asp脚本。
这是我们的ASP代码
Sub SendEmail(fromEmail, toEmail, ccEmail, bccEmail, subject, body, somefiles)
Set m_Mailer = Server.CreateObject("CDO.Message")
With m_Mailer.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smptserver") = Request.ServerVariables("server_name")
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")=SMTP_SERVER_PICKUP_DIRECTORY
.Update
End With
If m_CharacterSet <> "" Then
m_Mailer.BodyPart.Charset = m_CharacterSet
End If
m_Mailer.To = toEmail
m_Mailer.CC = ccEmail
m_Mailer.BCC = bccEmail
m_Mailer.From = fromEmail
m_Mailer.ReplyTo = fromEmail
m_Mailer.Subject = subject
If m_UseHtmlFormat Then
m_Mailer.HTMLBody = FixText(body)
Else
m_Mailer.TextBody = FixText(body)
End If
Dim i
somefiles = Split(somefiles, vbTab)
For i = 0 to UBound(somefiles)
m_Mailer.AddAttachment(somefiles(i))
Next
m_Mailer.Send
End Sub
我已检查mailroot文件夹的权限,IIS用户具有完全控制权。我已经将中继设置为127.0.0.1,并且还允许IIS用户访问smtp。
当我使用telnet时,我会在日志中获取所有内容并正确接收电子邮件。
但即使使用此测试脚本我也没有收到任何电子邮件,他们仍然卡在拾取文件夹
Dim emailer
Set emailer = New EmailHelper
emailer.SendEmail "test@test.com", "fede@shocklogic.com", "", "", "Test 1 2 3 from " & Request.ServerVariables("HTTP_HOST"), "Test...", ""
Set emailer = Nothing
Response.Write "DONE"
当我尝试执行此测试脚本时,我总是在页面上显示“DONE”,但没有电子邮件。
已安装并启用SMTP。
任何帮助都会很棒
答案 0 :(得分:1)
找到解决方案! (至少它对我有用)
我删除了这一行
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")=SMTP_SERVER_PICKUP_DIRECTORY
在IIS 7控制台中配置SMTP以使用localhost而不是拾取目录,现在工作正常!