Ошибка получателя формы ASP - PullRequest
1 голос
/ 20 ноября 2008

У меня есть форма, которая при заполнении и отправке работает нормально. Когда получатель отвечает отправителю, электронное письмо фактически отправляется ему, а не предполагаемой стороне.

Ниже приведена форма. Помогите!

<%
Dim roomsanswer, fashionsanswer, commentsanswer, nameanswer, addressanswer, citystateanswer, zipanswer, phoneanswer, phone2answer, emailanswer, bccaddress, toaddress
If Request.Form("SendButton") <> "Send" Then
%>  
    <form action="<%=Request.ServerVariables("URL")%>" method="post" id="contactform">
      <h2>I am thinking about the windows in these rooms: (Please check as many answers as you like)</h2>
      <p>
        <input type="checkbox" name="rooms" value="living Room" />
        Living Room
        <input type="checkbox" name="rooms2" value="Dining Room" />
        Dining Room
        <input type="checkbox" name="rooms2" value="Family Room" />
        Family Room
        <input type="checkbox" name="rooms2" value="Bonus or Recreation Room" />
        Bonus or Recreation Room </p>
      <p>
        <input type="checkbox" name="rooms2" value="Kitchen and/or Bathrooms" />
        Kitchen and/or Bathrooms
        <input type="checkbox" name="rooms2" value="Bedroom(s) " />
        Bedroom(s)</p>
      <h3>&nbsp;</h3>
      <h2>I am most interested in these window fashions:</h2>
      <p>
        <input type="checkbox" name="fashions" value="Blinds" />
        Blinds
        <input type="checkbox" name="fashions" value="Shades" />
        Shades
        <input type="checkbox" name="fashions" value="Shutters" />
        Shutters
        <input type="checkbox" name="fashions" value="Window Shadings" />
        Window Shadings (Silhouette, etc.)
        <input type="checkbox" name="fashions" value="Draperies &amp; Top Treatments" />
      Draperies &amp; Top Treatments 
      <input type="checkbox" name="fashions" value="Decorative Hardware &amp; Controls" />
      Decorative Hardware &amp; Controls
      <input type="checkbox" name="fashions" value="Sun &amp; Light Control Products" />
      Sun &amp; Light Control Products</p>
      <p>&nbsp;</p>
      <h2>Here's what I'd like to do, or talk with the decorator about:&nbsp;<br />
          <textarea name="comments" cols="47" rows="9" wrap="physical" id="comments"></textarea>
      </h2>
      <p><strong>My Name:</strong>&nbsp;
          <input type="text" name="name" size="45" maxlength="50" />
      </p>
      <p><strong>My Address:</strong>&nbsp;
          <input name="address" type="text" id="address" size="45" maxlength="50" />
      </p>
      <p><strong>My City &amp; State:</strong>&nbsp;
          <input name="citystate" type="text" id="citystate" size="45" maxlength="50" />
      </p>
      <p><strong>My Zipcode:</strong>&nbsp;
          <input name="zip" type="text" id="zip" size="10" maxlength="5" />
      </p>
      <h2>&nbsp;</h2>
      <h2>My Telephones </h2>
      <p><strong>Daytime Telephone:</strong>&nbsp;
          <input type="text" name="phone" size="12" maxlength="15" />
      </p>
      <p><strong>Evening Telephone:</strong>&nbsp;
          <input type="text" name="phone2" size="12" maxlength="15" />
      </p>
      <p><strong>Email address:</strong>&nbsp;
          <input type="text" name="email" size="45" maxlength="50" />
      </p>
      <p><br />
          <input type="submit" value="Send" name="SendButton" />
        &nbsp;
        <input type="reset" value="Clear" name="ClearButton" class="form" />
      </p>
    </form>
<%

'*** If the SendButton was clicked
'*** and there is a message to send,
'*** process the email and send it.
Else

'*** Create the message object.
Set Message = Server.CreateObject("CDO.Message")

'*** Validate Input
commentsanswer = Request.Form("comments")
If commentsanswer = "" then
commentsanswer = "(No Additional Comments Given)"
End If

roomsanswer = Request.Form("rooms")
If roomsanswer = "" then
roomsanswer = "(No Rooms Given)"
End If

fashionsanswer = Request.Form("fashions")
If fashionsanswer = "" then
fashionsanswer = "(No Fashions Given)"
End If

nameanswer = Request.Form("name")
If nameanswer = "" then
nameanswer = "(No name given)"
End If

addressanswer = Request.Form("address")
If addressanswer = "" then
addressanswer = "(No address given)"
End If

citystateanswer = Request.Form("citystate")
If citystateanswer = "" then
citystateanswer = "(No city and state given)"
End If

zipanswer = Request.Form("zip")
If zipanswer = "" then
zipanswer = "(No zipcode given)"
End If

phoneanswer = Request.Form("phone")
If phoneanswer = "" then
phoneanswer = "(No phone number given)"
End If

phone2answer = Request.Form("phone2")
If phone2answer = "" then
phone2answer = "(No phone number given)"
End If

emailanswer = Request.Form("email")
If emailanswer <> "" then
toaddress = Request.Form("email")
bccaddress = "xxxxxx@aol.com"
End If

If emailanswer = "" then
emailanswer = "(No email address given)"
toaddress = "xxxxxx@aol.com"
bccaddress = ""
End If

'*** Set the from, to, and
'*** subject fields.

Message.From = "xxxxxx@aol.com"
Message.To = toaddress
Message.bcc = bccaddress & "," & ""
Message.Subject = "Customer Contact Information from Website"
Message.TextBody = vbcrlf & "Date and Time: " & Now() & vbcrlf & vbcrlf & " I am thinking about the windows in these rooms: " & roomsanswer & vbcrlf & vbcrlf & "I am most interested in these window fashions: " & fashionsanswer & vbcrlf & vbcrlf & "Here's what I'd like to do, or talk with the decorator about: " & commentsanswer & vbcrlf & vbcrlf & " My Name:" & vbcrlf & nameanswer & vbcrlf & vbcrlf & "My Address:" & vbcrlf & addressanswer & vbcrlf & vbcrlf & "My City & State:" & vbcrlf & citystateanswer & vbcrlf & vbcrlf & "My Zipcode:" & vbcrlf & zipanswer & vbcrlf & vbcrlf & "My Daytime Phone:" & vbcrlf & phoneanswer & vbcrlf & vbcrlf & "My Evening Phone:" & vbcrlf & phone2answer

'*** If there is an error, 
'*** continue with the script.
On Error Resume Next

'*** Send the email message.
Message.Send

'*** If sending the message caused
'*** an error, then display the 
'*** message, else display a
'*** success message (or redirect
'*** to a different page).
If Err.Number = 0 Then
Response.Redirect("thankyou.html")
Else
Response.Write "Error: " & Err.Description
End If

'*** Clear out the message variable
Set Message = Nothing

'*** End of If for checking
'*** SendButton and message
'*** to send.
End If

%>

1 Ответ

1 голос
/ 20 ноября 2008

Это http://support.microsoft.com/kb/181408 что вы хотите?

...