简体   繁体   English

检查Volusion Windows服务器上是否支持CDO电子邮件

[英]Check if CDO e-mail is supported on Volusion Windows server

I am trying to use CDO to send e-mail through a Volusion Windows server. 我正在尝试使用CDO通过Volusion Windows服务器发送电子邮件。 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. 我编写的ASP脚本在GoDaddy Windows服务器上可以正常工作,因此我知道该脚本是正确的,但在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. 在该脚本中,我使用了GoDaddy的relay-hosting.secureserver.net SMTP服务器发送电子邮件,它在GoDaddy服务器上运行良好,但在Volusion上却无法正常工作。

I've tried several SMTP servers. 我已经尝试了几个SMTP服务器。 Volusion provides documentation on their mail servers here: Volusion在此处提供有关其邮件服务器的文档:

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). 我已经尝试了带SSL的SMTP服务器和没有脚本的SMTP服务器(并且还尝试了所有不同的端口)。

I'm wondering if the ability to send e-mails with CDO is not supported on Volusion servers? 我想知道Volusion服务器是否不支持使用CDO发送电子邮件的功能? Is there a way to check if a server supports CDO without having access to the cPanel, WHM or any core files? 有没有一种方法可以检查服务器是否支持CDO而无需访问cPanel,WHM或任何核心文件? With Volusion, they only give you access to part of the FTP. 使用Volusion,它们仅使您可以访问部分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 微软IIS / 6.0

To answer your initial question, how to check CDO is supported. 为了回答您的第一个问题,支持如何检查CDO。

Here is a quick example of checking for the Object Required error (or any error for that matter while instantiating the CDO COM object. 这是检查Object Required错误(或在实例化CDO COM对象时与此有关的任何错误)的快速示例。

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 在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. 经过数次评论后,决定深入研究Volusion (必须承认我没有遇到过,并且在Google中进行了快速搜索后发现了此链接。

Quote from The VSMTP Key VSMTP密钥引用

A special ASP class is provided for use with Volusion's built-in send-mail component, VSMTP. 提供了一个特殊的ASP类,可与Volusion的内置发送邮件组件VSMTP一起使用。

You can use this class to create your own send mail solutions for your store using ASP. 您可以使用此类使用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. 该解决方案提供了替代方法,可通过Volusion的基于POP或基于Webmail的标准解决方案发送电子邮件。

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. 如果您使用的是Volusion的标准电子邮件托管资源(POP,IMAP或Webmail),则无需更新商店或my.volusion.com帐户中的任何功能。

To use the VSMTP component with your Volusion store, you will need to download Volusion's VSMTP ASP class . 要在您的Volusion存储中使用VSMTP组件,您将需要下载Volusion的VSMTP ASP类

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 . Object Required ASP组件错误来判断,在尝试实例化CDO组件时,我会说Volusion服务器不支持CDO

There is a simple example shown using the VSMTP ASP class 有一个使用VSMTP ASP类显示的简单示例

<%
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. 最好的选择是调整现有脚本,以使用Volusion支持的VSMTP定制类。

Looking at the VSMTP ASP class, it looks like it's a simple wrapper to POST to an ASP endpoint ( vsmtp.asp ). 查看VSMTP ASP类,它看起来像是对POST到ASP端点( 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
%>

Short answer, you cannot. 简短的答案,你不能。 You will get an error message that states Access is denied . 您将收到一条错误消息,指出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 (eg Headers) are limited to what is provided. VSMTP是直接从Volusion发送电子邮件的唯一替代方法,但是,您只能从其SMTP服务器发送邮件,并且选项(例如Header)仅限于所提供的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM