2011-12-03 28 views
0

私のUncles Webサイトの連絡先フォームの問題を解決しようとしていますが、問題を把握できません。ライブサイトでフォームを送信すると、500 Internal Serverエラーが表示されます - 探しているリソースに問題があり、表示できません。ASPフォームがWebページに投稿されていません

私はIISがインストールされているように私のデスクトップ上でこれを整理しようとしていますし、私はIIS内のページにあるフォームを使用する場合、それはこのエラーを示しています

CDO.Message.1 error '80040220' 

The "SendUsing" configuration value is invalid. 

/contact.asp, line 60 

フォームのコードは次のとおりです。

<% 
sectionID=8 

frmName = request.Form("frmName") 
frmEmail = request.Form("frmEmail") 
frmPhone = request.Form("frmPhone") 
frmAddress = request.Form("frmAddress") 
frmReferral = request.Form("frmReferral") 
frmCallback = request.Form("frmCallback") 
frmEnquiry = request.Form("frmEnquiry") 

if len(frmName) = 0 then 
    errormessage = "<p><b style=""color: red"">Name field left blank.</b></p>" 
elseif len(frmEmail) = 0 then 
    errormessage = "<p><b style=""color: red"">E-mail field left blank.</b></p>" 
elseif len(frmPhone) = 0 then 
    errormessage = "<p><b style=""color: red"">Phone field left blank.</b></p>" 
end if 

if request.TotalBytes <> 0 and len(errormessage) = 0 then 

    if len(frmReferral) = 0 then frmReferral = "(left blank)" end if 
    if len(frmCallback) = 0 then frmCallback = "(left blank)" end if 
    if len(frmAddress) = 0 then frmAddress = "(left blank)" end if 
    if len(frmEnquiry) = 0 then frmEnquiry = "(left blank)" end if 

    'send email 
    '---------- 
    Set objCDO = Server.CreateObject("CDO.Message") 
    objCDO.To = "[email protected]" 

    objCDO.From = frmEmail 
    objCDO.Subject = "Moroccan Properties - Enquiry Form" 

    bodyHTML = "Name:" & vbcrlf _ 
       & frmName & vbcrlf _ 
       & vbcrlf _ 
       & "Email:" & vbcrlf _ 
       & frmEmail & "" & vbcrlf _ 
       & vbcrlf _ 
       & "Phone:" & vbcrlf _ 
       & frmPhone & "" & vbcrlf _ 
       & vbcrlf _ 
       & "Address:" & vbcrlf _ 
       & frmAddress & "" & vbcrlf _ 
       & vbcrlf _ 
       & "How did you hear about us?:" & vbcrlf _ 
       & frmReferral & "" & vbcrlf _ 
       & vbcrlf _ 
       & "Do you require a callback?:" & vbcrlf _ 
       & frmCallback & "" & vbcrlf _ 
       & vbcrlf _ 
       & "Enquiry:" & vbcrlf _ 
       & frmEnquiry 

    'response.Write(bodyHTML) 
    'response.End 

    objCDO.TextBody = bodyHTML 
    objCDO.Send 
    Set objCDO = Nothing 

    response.Redirect("contact-thankyou.asp") 

end if %> 

ライン60のコードは次のとおりです。objCDO.Send

誰かがこの問題で私を助けることができる場合、私は非常に感謝されます。

おかげ

編集:

<!--<form action="contact.asp" method="post" onsubmit="return validateRequired();">--> 
       <form action="contact.asp" method="post"> 
        <table border="0" cellpadding="2" cellspacing="0" class="text"> 
         <tr> 
          <td><p>Name : * </p></td> 
          <td><input name="frmName" id="frmName" type="text" class="textbox" value="<%=frmName%>" size="35" title="Required" /></td> 
         </tr> 
         <tr> 
          <td><p>Email : *</p></td> 
          <td><input name="frmEmail" id="frmEmail" type="text" class="textbox" value="<%=frmEmail%>" size="35" title="Required" /></td> 
         </tr> 
         <tr> 
          <td><p>Phone : *</p></td> 
          <td><input name="frmPhone" id="frmPhone" type="text" class="textbox" value="<%=frmPhone%>" size="35" title="Required" /></td> 
         </tr> 
         <tr> 
          <td><p>Address :</p></td> 
          <td><input name="frmAddress" id="frmAddress" type="text" class="textbox" value="<%=frmAddress%>" size="35" /></td> 
         </tr> 
         <tr> 
          <td><p>How did you hear about us :</p></td> 
          <td><select name="frmReferral" id="frmReferral" class="block" style="width: 180px"> 
          <option value=""> - SELECT - </option> 
          <option value="Magazine advert"<%if frmReferral = "Magazine advert" then%> selected="true"<%end if%>>Magazine advert</option> 
          <option value="Booklet advert"<%if frmReferral = "Booklet advert" then%> selected="true"<%end if%>>Booklet advert</option> 
          <option value="Web search"<%if frmReferral = "Web search" then%> selected="true"<%end if%>>Web search</option> 
          <option value="Web directory"<%if frmReferral = "Web directory" then%> selected="true"<%end if%>>Web directory</option> 
          <option value="Newspaper"<%if frmReferral = "Newspaper" then%> selected="true"<%end if%>>Newspaper</option> 
          <option value="TV"<%if frmReferral = "TV" then%> selected="true"<%end if%>>TV</option> 
          <option value="Other"<%if frmReferral = "Other" then%> selected="true"<%end if%>>Other</option> 
          </select> 
          </td> 
         </tr> 
         <tr> 
          <td><p>Do you require a call back :</p></td> 
          <td><select name="frmCallback" id="frmCallback" class="block" style="width: 180px"> 
          <option value=""> - SELECT - </option> 
          <option value="Morning"<%if frmCallback = "Morning" then%> selected="true"<%end if%>>Morning</option> 
          <option value="Afternoon"<%if frmCallback = "Afternoon" then%> selected="true"<%end if%>>Afternoon</option> 
          <option value="Not Required"<%if frmCallback = "Not Required" then%> selected="true"<%end if%>>Not Required</option> 
          </select> 
          </td> 
         </tr> 
         <tr> 
          <td align="left" valign="top"><p>Enquiry :</p></td> 
          <td><textarea name="frmEnquiry" id="frmEnquiry" cols="27" rows="4" class="textbox" style="width: 180px"><%=frmEnquiry%></textarea></td> 
         </tr> 
         <tr> 
          <td>&nbsp;</td> 
          <td align="right"><input name="submit" type="submit" value=" Send " class="submit"> 
          &nbsp;&nbsp;&nbsp; 
          <input name="reset" type="reset" class="submit"></td> 
         </tr> 
        </table> 
        <p>&nbsp;</p> 
       </form> 
また

私の叔父は、新しいホストにファイルを移動すると、この動作を停止し、これは前にしかし、すぐに働いていた:これは、HTMLのフォームがある

+0

これは過去にありました - http://classicasp.aspfaq.com/email/how-do -i-send-e-mail-with-cdo.htmlと一致するようにコードを修正します。どのバージョンのIISを使用していますか? – dash

+0

これは助けになるかもしれません:http://forums.iis.net/t/1146477.aspx – Oded

+0

@ダッシュ私はバージョン7.5を使用しています – user1060444

答えて

0

メールサーバーを探す場所をWebサーバーに伝える必要があります。したがって、CDO.Messageオブジェクトに加えて、CDO.Configurationオブジェクトを作成する必要があります。

sch = "http://schemas.microsoft.com/cdo/configuration/" 

Set objConfig = CreateObject("CDO.Configuration") 

With objConfig.Fields 
    .Item(sch & "sendusing") = 2 
    .Item(sch & "smtpserver") = "enter_mail.server_here" 
    // There are other settings which your mail server might 
    // need, such as smtpserverport, smtpconnectiontimeout, 
    // smtpauthenticate, etc. 
    .update 
End With 

Set objCDO = Server.CreateObject("CDO.Message") 
Set objCDO.Configuration = objConfig 
objCDO.To = "[email protected]" 

objCDO.From = frmEmail 
objCDO.Subject = "Moroccan Properties - Enquiry Form" 

bodyHTML = [stuff] 
bodyText = [stuff] 

objCDO.TextBody = bodyText 
objCDO.HtmlBody = bodyHTML 

objCDO.Send 
Set objCDO = Nothing 
Set objConfig = Nothing 
関連する問題