繁体   English   中英

通过 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

暂无
暂无

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

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