Question

I am trying to use CDO to send e-mail through a Volusion Windows server. The ASP script I've written works fine on a GoDaddy Windows server so I know the script is correct but it doesn't work through Volusion. In that script, I had used GoDaddy's relay-hosting.secureserver.net SMTP server to send the e-mail and it worked great on the GoDaddy server but not on Volusion.

I've tried several SMTP servers. Volusion provides documentation on their mail servers here:

https://support.volusion.com/article/connecting-my-volusion-e-mail-account

I've tried both the SMTP servers with SSL and without in the script (and have also tried all the different ports).

I'm wondering if the ability to send e-mails with CDO is not supported on Volusion servers? Is there a way to check if a server supports CDO without having access to the cPanel, WHM or any core files? With Volusion, they only give you access to part of the FTP.

Thanks for your help!

EDIT

Here is the code I used that worked:

<%
sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing"
smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver"

' Set the mail server configuration
Set objConfig=CreateObject("CDO.Configuration")
objConfig.Fields.Item(sendUrl)=2
objConfig.Fields.Item(smtpUrl)="relay-hosting.secureserver.net"
' Server port (typically 25)
objConfig.Fields.Update

' Create and send the mail
Set myMail=CreateObject("CDO.Message")
' Use the config object created above
Set myMail.Configuration=objConfig
myMail.From="test@test.com"
myMail.To="test@test.com"
myMail.Subject = "Test Subject"
myMail.HTMLBody = "Test"
myMail.Send                 

Set myMail = Nothing

response.write "Success!!"
%>

I've obviously updated those e-mail address when I run the code.

EDIT

To answer a question in the comments my server version is:

Microsoft-IIS/6.0

Was it helpful?

Solution

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 = "test@testdomain.com"
mailer.EmailTo = "test@testdomain.com"
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
%>

OTHER TIPS

Short answer, you cannot. You will get an error message that states Access is denied. VSMTP is the only alternative to sending email directly from Volusion, however, you can only send from their SMTP servers and the options (e.g. Headers) are limited to what is provided.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top