0
我覺得我在這裏錯過了一些東西..我已經添加了幾個不同的東西給vbscript來嘗試使它僅在提交按鈕被點擊而不是兩次時運行(第二頁加載然後提交),但它破壞了它或者沒有工作。任何幫助這個初學者程序員將不勝感激。如果你需要html,請告訴我。編輯:仍在尋求幫助! :(VBScript運行兩次,一次頁面加載,一次提交。只需要提交?
<% Sub sendEmail(mailFrom, mailTo, mailSubject, mailMessage, mailServer, mailUsername, mailPassword)
Set MyMail = CreateObject("cdo.message")
MyMail.From = mailFrom
MyMail.To = mailTo
MyMail.Subject = mailSubject
MyMail.HTMLBody = mailMessage
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mailServer
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = mailUsername
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = mailPassword
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
MyMail.Configuration.Fields.Update
MyMail.Send
Set MyMail = nothing
End Sub
Dim mailFrom, mailTo, mailSubject, mailMessage, mailServer, mailUsername, mailPassword
mailFrom = Request.form(example)
mailTo = "example"
mailSubject = "example"
mailMessage = "example"
mailServer = "example"
mailUsername = "example"
mailPassword = "example"
Call sendEmail(mailFrom, mailTo, mailSubject, mailMessage, mailServer, mailUsername, mailPassword)
%>
我試過之前添加過,它似乎沒有工作。我把如果request.form(email)=「」then else'vbscript code'end if if?那是錯的嗎? – Control
你引用了這個名字嗎? '的request.form( 「電子郵件」)'?如果是這樣,你需要編輯你的問題與代碼+ html –
當我這樣做(隱藏領域),一切運行良好,我只是從來沒有收到電子郵件,可能不會發送它。 – Control