2012-06-22 99 views
1

我目前正在更新舊服務器上的許多測試網站,以便在未來幾個月內舊服務器停止使用時,它們不會中斷。一個網站的聯繫表格已經被打破。當用戶點擊他們的信息填寫後提交,它們都帶有這樣的錯誤:將SMTP郵件程序轉換爲經典ASP中的CDOSYS以用於聯繫表格

Server object error 'ASP 0177 : 800401f3' 

Server.CreateObject Failed 

/contactsubmit.asp, line 79 

800401f3 


Set Mailer = Server.CreateObject("SMTPsvg.Mailer") 
Mailer.FromName = "Web Visitor" 
If request("email") <> "" then 
    Mailer.replyto = request("email") 
Else 
    Mailer.replyto = "[email protected]" 
End If 
Mailer.FromAddress = "[email protected]" 
Mailer.RemoteHost = "hostserver" 
If TempTest = TRUE then 
Else 
    Mailer.AddRecipient siteOwner, ContactEmail 
    If ContactCC <> "" then 
    Mailer.AddCC siteOwner, ContactCC 
    End If 
End If 
If DesignerEmail <> "" then 
    Mailer.AddBCC DesignerEmail, DesignerEmail 
End If 
Mailer.Subject = siteOwner & " Contact Form" 
Mailer.ContentType = "text/html" 
Mailer.BodyText = strBody 
If Mailer.SendMail then 
    response.redirect "contact.asp?sent=yes" 
Else 
    response.redirect "contact.asp?sent=no" 
End If 

有人告訴我,SMTP是不是電子郵件需要得到再發送的方式,所以我嘗試這一切變爲CDOSYS。但有趣的是,這臺服務器上有更多的網站,我已經使用相同的SMTP代碼進行了測試。 更改使用CDOSYS:

Set Mailer = Server.CreateObject("CDO.Message") 
Mailer.From = "Web Visitor <[email protected]>" 
If request("email") <> "" then 
    Mailer.ReplyTo = request("email") 
Else 
    Mailer.ReplyTo = "[email protected]" 
End If 
Mailer.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "hostserver" 
If TempTest = TRUE then 
Else 
    Mailer.AddRecipient siteOwner, ContactEmail 
    If ContactCC <> "" then 
    Mailer.Cc siteOwner, ContactCC 
    End If 
End If 
If DesignerEmail <> "" then 
    Mailer.Bcc DesignerEmail, DesignerEmail 
End If 
Mailer.Subject = siteOwner & " Contact Form" 
Mailer.HTMLBody = strBody 
If Mailer.Send then 
    response.redirect "contact.asp?sent=yes" 
Else 
    response.redirect "contact.asp?sent=no" 
End If 

但現在我得到這個錯誤:

Microsoft VBScript runtime error '800a01b6' 

Object doesn't support this property or method: 'Mailer.AddRecipient' 

/contactsubmit.asp, line 89 

我已經嘗試過了,沒有運氣更改爲Mailer.AddMailer.AddAddress。有誰知道我如何解決這個錯誤,並希望得到這個工作?我從來沒有使用郵件服務器,所以我很抱歉,如果這是一個簡單的修復,但我已經搜索了過去3個小時,並不能提出一個很好的替代.AddRecipient

回答

0

嘗試執行以下使用CDO,然後從中取相關領域,並適用於你的腳本發送郵件的最簡單的方法:

Set myMail=CreateObject("CDO.Message") 
myMail.Subject="Sending email with CDO" 
myMail.From="[email protected]" 
myMail.To="[email protected]" 
myMail.TextBody="This is a message." 
myMail.Send 
set myMail=nothing 

正如你可以看到添加收件人的方式是這樣的:

myMail.To="[email protected]" 

你可以看到更多的例子here

希望這有助於。

+0

所以,如果我理解正確,我有'ReplyTo'應該是'.To' – jlg

+0

'Reply.To'住,但是你的'Mailer.AddRecipient'應該變成'Mailer.To' – 03Usr

+0

謝謝你的幫助!郵寄員一直在工作:D – jlg