To answer your initial question, how to check CDO is supported.
Here is a quick example of checking for the Object Required
error (or any error for that matter while instantiating the CDO COM object.
Dim cdo, is_cdosupported
On Error Resume Next
Err.Clear
Set cdo = Server.CreateObject("CDO.Configuration")
is_cdosupported = (Err.Number <> 0)
On Error Goto 0
If is_cdosupported Then
Call Response.Write("CDO is supported")
Else
Call Response.Write("CDO not supported")
End If
Digging around on Google
After commenting a few times decided to dig into Volusion (must admit not one I've come across and after a quick search in Google found this link.
Quote from The VSMTP Key
A special ASP class is provided for use with Volusion's built-in send-mail component, VSMTP.
You can use this class to create your own send mail solutions for your store using ASP. Note that the information being provided in this article is intended for advanced users. This solution provides an alternate to sending email via Volusion's standard POP-based or webmail-based solutions.
If you're using Volusion's standard email hosting resources (POP, IMAP, or Webmail), you will not be required to update any functions within your store or my.volusion.com account.
To use the VSMTP component with your Volusion store, you will need to download Volusion's VSMTP ASP class.
Judging by the Object Required
ASP component error you get when trying to instantiate the CDO components I would say that CDO is not supported by Volusion servers.
There is a simple example shown using the VSMTP ASP class
<%
Dim mailer
Set mailer = new vsmtp
mailer.VsmtpKey = "65539C7A-525C-4CB7-B36B-BFBBDD332DD6"
mailer.EmailSubject = "Test Subject"
mailer.EmailFrom = "[email protected]"
mailer.EmailTo = "[email protected]"
mailer.TextBody = "Hello World!"
mailer.HTMLBody = "Hello World"
mailer.AddAttachment Server.MapPath("/v/test1.txt")
mailer.AddAttachment "/v/test2.txt"
mailer.Send()
%>
Your best bet is to adapt your existing script to use this VSMTP bespoke class that is support by Volusion.
Looking at the VSMTP ASP class, it looks like it's a simple wrapper to POST
to an ASP endpoint (vsmtp.asp
).
<%
Class vsmtp
Public VsmtpKey
Public EmailSubject
Public EmailFrom
Public EmailTo
Public TextBody
Public HTMLBody
Private Attachment
Private AttachmentFolder
Public Sub AddAttachment(ByRef FilePath)
If AttachmentFolder = "" Then
AttachmentFolder = Server.MapPath("/v")
End If
If StrComp(Left(FilePath,Len(AttachmentFolder)),AttachmentFolder,vbTextCompare) = 0 Then
FilePath = Replace(Mid(FilePath,Len(AttachmentFolder)-1),"\","/")
End If
If StrComp(Left(FilePath,3),"/v/",vbTextCompare) <> 0 Or InStr(FilePath,",") > 0 Then
Err.Raise 512, "vsmtp.AddAttachment", "Invalid Attachment Path"
End If
If IsEmpty(Attachment) Then
Attachment = FilePath
Else
Attachment = Attachment & "," & FilePath
End If
End Sub
Public Sub Send()
Dim HTTPRequest
Set HTTPRequest = CreateObject("WinHTTP.WinHTTPRequest.5.1")
HTTPRequest.Open "POST", "http://" & Request.ServerVariables("LOCAL_ADDR") & "/vsmtp.asp", False
HTTPRequest.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
HTTPRequest.SetRequestHeader "Host", Request.ServerVariables("SERVER_NAME")
HTTPRequest.Send _
"VsmtpKey=" & Server.URLEncode(VsmtpKey) &_
"&Subject=" & Server.URLEncode(EmailSubject) &_
"&FromEmailAddress=" & Server.URLEncode(EmailFrom) &_
"&ToEmailAddress=" & Server.URLEncode(EmailTo) &_
"&Body_HTML=" & Server.URLEncode(HTMLBody) &_
"&Body_TextOnly=" & Server.URLEncode(TextBody) &_
"&Attachment_CSV=" & Server.URLEncode(Attachment)
If HTTPRequest.ResponseText <> "True" Then
Set HTTPRequest = Nothing
Err.Raise 8, "vsmtp.Send", "Unable to send email. Check logs for details."
End If
Set HTTPRequest = Nothing
End Sub
End Class
%>
Server.CreateObject("CDO.Message")
? If you can the CDO is registered for COM and can be used through asp-classic. – user692942