通过 Godaddy 使用 Classic ASP 发送电子邮件

Sending email with Classic ASP through Godaddy

我正尝试从我在 Godaddy 的网站上使用 Classic ASP 发送电子邮件。不幸的是,我 10-15 年前的鳕鱼不起作用(想象一下!大声笑)。这是代码。有人能告诉我从那以后发生了什么变化吗?急切地等待您的答复。谢谢!

    Set cdoConfig = CreateObject("CDO.Configuration") 
    With cdoConfig.Fields
      .Item(cdoSMTPConnectionTimeout) = 10
      .Item(cdoSMTPAuthenticate) = false
      .Item(cdoSendUserName) = "email@mywebsite.com"
      .Item(cdoSendPassword) = "MyPassword"
      .Item(cdoURLProxyServer) = "server:25"
     '.Item(cdoSendUsingMethod) = cdoSendUsingPickup
      .Item(cdoSendUsingMethod) = cdoSendUsingPort
      .Item(cdoSMTPServer) = "relay-hosting.secureserver.net"
      .Item(cdoURLGetLatestVersion) = True
      .Update
    End With

'Create mail object
Set cdoMessage = CreateObject("CDO.Message")

'Apply the settings to the message object then send the email
With cdoMessage
    Set .Configuration = cdoConfig
    .From = "Support (email@mywebsite)"
    .To = "The User (user@email.com)"
    .BCC = ""
    .Subject = "This is a test email."
    .TextBody = "This is a test email. If it were a real email there would be some blah blah blah here! This concludes the test of the Godaddy email message."
    .Send
End With

'Cleanup mail objects
Set cdoMessage = Nothing
Set cdoConfig = Nothing

好的伙计们。这是为那些不时需要指导的人准备的。但是,请确保输入正确的用户名和密码。在 Godaddy 上托管时,您最多可以拥有三个不同的用户名和密码。您有 Godaddy 帐户的用户名和密码(不是!),您有 Plesk 的用户名和密码(也不是!)。然后你就有了你的主要网站的用户名和密码(这就是你想要的!)。即使您的主机下可能有多个不同的网站,但只有一个是主要网站。我的是与该主要网站相关联的电子邮件和密码。一旦你发布了这段代码,你就可以开始了。但是,您可能需要等待一段时间才能开始工作。对我来说,DNS 花了大约 8 个小时来掌握我正在做的事情并开始发送我的电子邮件。不过,一旦成功,现在效果很好!享受吧!

    Dim objNewMail

    'Your email information
    Set objNewMail = Server.CreateObject("CDO.Message")
    objNewMail.From = "your-email@this-website.com"
    objNewMail.Cc = "your-email@this-website.com"
    objNewMail.To   = "send-to@their-email.com"
    objNewMail.Subject = "This is a test email"
    objNewMail.TextBody = "this is a test email"

    ' GoDaddy SMTP Settings
    objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
    objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="relay-hosting.secureserver.net"
    objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 
    objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
    objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/cdoSendUserName") = "your-primary-website-username"
    objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/cdoSendPassword") = "your-primary-website-password"
    objNewMail.Configuration.Fields.Update
    objNewMail.Send

    'After the Send method, NewMail Object become Invalid
    Set objNewMail = Nothing