0
votes

On our existing platform we decided to upgrade our development server from Windows Server 2003 to 2008 some time ago.

The problem we are facing is that all asp scripts that used to send emails before when we had Windows Server 2003 worked. Now, they stopped working with no error on page or on the SMTP logs.

If I use telnet to send an email manually works fine.

But it's not working from our classic asp scripts.

This is our ASP code

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. I've already set the relay to 127.0.0.1, and gave the IIS User access to the smtp as well.

When I use telnet I get everything on the log and receive the email correctly.

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 "[email protected]", "[email protected]", "", "", "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.

SMTP is already installed and enabled.

Any help would be great

1
Very nice, but what is m_CharacterSet, and what does FixText do?Michiel
Also note, this line .Item("schemas.microsoft.com/cdo/configuration/smptserver") = Request.ServerVariables("server_name") - you have entered smptserver. Should read smtpserver.Carl Hine

1 Answers

1
votes

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!