0

在我们现有的平台上,不久前我们决定将我们的开发服务器从 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 已安装并启用。

任何帮助都会很棒

4

1 回答 1

1

找到了解决方案!(至少它对我有用)

我删除了这一行

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")=SMTP_SERVER_PICKUP_DIRECTORY

并在 IIS 7 控制台中配置 SMTP 以使用 localhost 而不是拾取目录,现在完美运行!

于 2013-05-21T10:38:31.693 回答