[英]IIS 7 + Windows Server 2008 - Sending Emails from Classic ASP using CDO
On our existing platform we decided to upgrade our development server from Windows Server 2003 to 2008 some time ago. 在我们现有的平台上,我们决定将我们的开发服务器从Windows Server 2003升级到2008年。
The problem we are facing is that all asp scripts that used to send emails before when we had Windows Server 2003 worked. 我们面临的问题是,在使用Windows Server 2003之前,曾经用于发送电子邮件的所有asp脚本。 Now, they stopped working with no error on page or on the SMTP logs. 现在,他们停止了工作,页面或SMTP日志上都没有错误。
If I use telnet to send an email manually works fine. 如果我使用telnet手动发送电子邮件,效果很好。
But it's not working from our classic asp scripts. 但这在我们的经典ASP脚本中不起作用。
This is our ASP code 这是我们的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
I've checked permissions on the mailroot folder and the IIS user has full control. 我已经检查了mailroot文件夹的权限,并且IIS用户具有完全控制权。 I've already set the relay to 127.0.0.1, and gave the IIS User access to the smtp as well. 我已经将中继设置为127.0.0.1,并为IIS用户授予了对smtp的访问权限。
When I use telnet I get everything on the log and receive the email correctly. 使用telnet时,我会在日志中获取所有内容并正确接收电子邮件。
But even when using this test script I don't get any email, they stay stuck on the pickup folder 但是,即使在使用此测试脚本时,我也没有收到任何电子邮件,但它们仍卡在提取文件夹中
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"
When I try to execute this test script I always get "DONE" on the page, but no email. 当我尝试执行此测试脚本时,页面上总是显示“ DONE”,但没有电子邮件。
SMTP is already installed and enabled. SMTP已安装并启用。
Any help would be great 任何帮助都会很棒
Found the solution! 找到了解决方案! (At least it works for me) (至少对我有用)
I removed this line 我删除了这条线
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")=SMTP_SERVER_PICKUP_DIRECTORY
And configured SMTP in IIS 7 console to use localhost instead of pickup directory and works perfect now! 并在IIS 7控制台中将SMTP配置为使用localhost而不是提取目录,并且现在可以正常使用!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.