ASP CDOSYS.DLL Differences on Win 2003 Server

Posted on 2007-07-30
Medium Priority
Last Modified: 2012-06-21
I have an active server page that works fine on a W2K server & exchange 2000 but am migrating to 2003 server with exchange 2003.
The page now returns an error when the page attempts to send the message with "iMsg.Send"
Anyone got any thoughts?

The subroutine code follows:-

Sub WhaleMailApproved
      'Create the CDO connections.
      Dim iMsg, iConf
      Dim Flds
      Const cdoSendUsingPort = 2
      Set iMsg = CreateObject("CDO.Message")
      Set iConf = CreateObject("CDO.Configuration")
      Set Flds = iConf.Fields

      'SMTP server configuration.
      With Flds

            'SMTP Parameters
            .Item(cdoSendUsingMethod) = cdoSendUsingPort
            .Item(cdoSMTPconnectiontimeout) = 30
            .Item(cdoSMTPServerPort) = 25
            .Item(cdoSMTPAuthenticate) = 1
            .Item(cdoSendUserName) = "Administrator"
            .Item(cdoSendPassword) = "*********"            
            'Set the SMTP server address here.
            .Item(cdoSMTPServer) = ""
      End With

      'Set the message properties.
      With iMsg
            Set .Configuration = iConf
            .From = "bookings@whalewatching.net"
            .To = "bookings@whalewatching.net"
            .Subject = "Booking Confirmation - " & CStr(transaction_number)
            MailBody =      "<font face=" & CHR(34) & "Verdana" & CHR(34) & " size=" & CHR(34) & "2" & CHR(34) & " color=" & CHR(34) & "000000" & CHR(34) & ">"      
            MailBody =      MailBody & Lastname & ", " & Firstname & "(ID:" & Trim(ID) & ", Phone: " & Trim(Phone) & " Email: " & ClientEmail & ")"
             MailBody =      MailBody & " has made Booking Number <b>"
             MailBody =      MailBody & CStr(transaction_number)
             MailBody =      MailBody & "</b> through the Website on " & Trim(BookDate) & ".<br><br>"
            MailBody =      MailBody & "Please check that this booking has been posted to MOMS correctly.<br><br>"
            MailBody =      MailBody & "The total amount paid was $" & FormatNumber(CStr(Paid),2)
            MailBody =      MailBody & " for " & FormatNumber(CStr(TotalPax),0) & " Pax"
            MailBody =      MailBody & " for the cruise on " & CruiseDate
            MailBody =      MailBody & "<br><br>Pax details are:-<br>"
            If AdultDir <> "0" Then
                  MailBody =      MailBody & "<br>" & CStr(AdultDir) & " x Adult - Direct"
            End If
            If ConcDir <> "0" Then
                  MailBody =      MailBody & "<br>" & CStr(ConcDir) & " x Concessional - Direct"
            End If
            If ChildDir <> "0" Then
                  MailBody =      MailBody & "<br>" & CStr(ChildDir) & " x Child - Direct"
            End If
            If FamilyDir <> "0" Then
                  MailBody =      MailBody & "<br>" & CStr(FamilyDir) & " x Family - Direct"
            End If
            If AdultEx <> "0" Then
                  MailBody =      MailBody & "<br>" & CStr(AdultEx) & " x Adult - Ex " & BusFrom
            End If
            If ConcEx <> "0" Then
                  MailBody =      MailBody & "<br>"  & CStr(ConcEx) & " x Concessional - Ex " & BusFrom
            End If
            If ChildEx <> "0" Then
                  MailBody =      MailBody & "<br>" & CStr(ChildEx) & " x Child - Ex" & BusFrom
            End If
            If FamilyEx <> "0" Then
                  MailBody =      MailBody & "<br>" & CStr(FamilyEx) & " x Family - Ex "  & BusFrom
            End If                  
            MailBody =      MailBody & "<br><br>Pickup: " & Pickup
            MailBody =      MailBody & "<br><br><b>The Whalewatching Web Assistant</b></font>"
            .HTMLBody = MailBody
      End With

      'Send the message.

      'Clean Up
      Set iMsg      = Nothing
      Set Flds      = Nothing
      Set iConf      = Nothing
End Sub
Question by:mrbungle50
  • 6
  • 5
  • 4
LVL 29

Accepted Solution

mass2612 earned 920 total points
ID: 19597824

Not sure if this will help but here's  a sub routine I use for sending e-mails from my scripts.

Dim objMessage
Dim strSender, strSendTo, strSMTPServer, strDomain

Sub subSendMail
 Set objMessage = CreateObject("CDO.Message")
     objMessage.Subject = "Enter subject here - " & objPrintQueue.Name      ' sets the subject line
     objMessage.Sender = strComputer & "@domainname.com" ' sets the sending address
     objMessage.From = strComputer & "@domainname.com" ' sets the sending address
     objMessage.To = "emailaddress@domainname.com"      ' sets the to address
     objMessage.TextBody = "Print queue is: " & objPrintQueue.Jobs     ' adds the queue size to message
     objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
     'SMTP Server
     objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtpserver.domainname.com"
     'SMTP Port
     objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
End sub
LVL 25

Assisted Solution

kevp75 earned 80 total points
ID: 19600077
what's the error you get?

Author Comment

ID: 19605254
the error is HTTP 500 internal server error
the website cannot display the page
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

LVL 25

Expert Comment

ID: 19605288
ok.  Can you make sure that you have turned off 'Friendly HTTP Errors' in your browser, and post back what the error really is  (or...just post a link to the page...)
LVL 25

Expert Comment

ID: 19605452
ok.  The issue is the fact that you do not have an EOF check before trying to pull a record.

In other words.  Your sub-routine is fine.  It's in the page ewaystatus.asp where you call a recordset that the problem lies

can you post the code here?

Author Comment

ID: 19605454
line 143 is imsg.send
LVL 25

Expert Comment

ID: 19605456
p.s.  For sake of the other experts that may want to get involved...the error is:
ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/eWaystatus.asp, line 173

Author Comment

ID: 19605723
Hi mass2612

That worked - thank you.

My problem now is that my exchange 2003 server will only allow an email to resolve internally. Can send to an email address outside of the servers domain?
LVL 29

Expert Comment

ID: 19605985
No problem. I am not sure what you might need to change to be able to send externally. I have never tried it. What happens when you try to use an external address are you getting a relay denied error or similar?

Author Comment

ID: 19614325
Hi mass2612,

Yes the error message is relay denied yet on the exchange 2000 server the same settings work fine. Is there something new in 2003 I need to set as it wont allow us to send email with relay off. With the original code you'll note we sent the administrator username & password yet in the copy you sent me it is not present. Could this have something to do with it?

Thank you.
LVL 29

Expert Comment

ID: 19614390
As I said I'm not sure about the script but you probably need to check the relay setup on the boxes. If you still have access to the Ex 2000 server then check the relaying for the virtual smtp server under Admin group > Server name > Protocols > Right clicn the virtual smtp server > Properties > Access make a note of the domains and settings allowed to send.

Then compare these settings with the Exchange 2003 server the settings are in pretty much the same space off the top of my head.
LVL 29

Expert Comment

ID: 19614907
One more thing under the virtual smtp server properties on the Ex 2003 box, under Access > Authentication is allow annonymous authentication enabled?

Author Comment

ID: 19615652
All done - none were set in the old server however I aded the IP address & subnet mask of he new & working fine. Thanks heaps for your time & assistance.
LVL 29

Expert Comment

ID: 19615980
Good to hear.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The main intent of this article is to make you aware of ‘Exchange fail to mount’ error, its effects, causes, and solution.
This article will help to fix the below errors for MS Exchange Server 2016 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question