|
| |
|
|
computertriage
Posts: 1 Joined: 9/29/2009 Status: offline
|
Contact form generator for expression - 9/29/2009 1:35:07
i used http://www.ctrfx.com/form/default.aspx to generate my contact form. however, i'm having some difficulties: here's the error as soon as I hit submit: Due to technical difficulty, your message may NOT have been sent. This is how my outgoing information looks: Dim SendResultsTo As String = "customerservice@computertriage.us" Dim smtpMailServer As String = "relay-hosting.secureserver.net" Dim smtpUsername As String = "" Dim smtpPassword As String = "" Dim MailSubject As String = "Form Results" I spoke with godaddy and they said that I don't need a username and password. which i already knew. It's not working with the above configuration. So I tried using my personal email account with the sendstring, smtp, username,and password and still having problems: If anyone knows what the problem is, let me know. I tried everthing and no go: here's my full html : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ Page Language="VB" %> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled 1</title> </head> <body> <script runat="server"> Protected Sub SubmitForm_Click(ByVal sender As Object, ByVal e As System.EventArgs) If Not Page.IsValid Then Exit Sub Dim SendResultsTo As String = "customerservice@computertriage.us" Dim smtpMailServer As String = "relay-hosting.secureserver.net" Dim smtpUsername As String = "" Dim smtpPassword As String = "" Dim MailSubject As String = "Form Results" Try Dim txtQ As TextBox = Me.FormContent.FindControl("TextBoxQ") If txtQ IsNot Nothing Then Dim ans As String = ViewState("hf1") If ans.ToLower <> txtQ.Text.ToLower Or ans.ToUpper <> txtQ.Text.ToUpper Then Me.YourForm.ActiveViewIndex = 3 Exit Sub End If End If Dim FromEmail As String = SendResultsTo Dim msgBody As StringBuilder = New StringBuilder() Dim sendCC As Boolean = False For Each c As Control In Me.FormContent.Controls Select Case c.GetType.ToString Case "System.Web.UI.WebControls.TextBox" Dim txt As TextBox = CType(c, TextBox) If txt.ID.ToLower <> "textboxq" Then msgBody.Append(txt.ID & ": " & txt.Text & vbCrLf & vbCrLf) End If If txt.ID.ToLower = "email" Then FromEmail = txt.Text End If If txt.ID.ToLower = "subject" Then MailSubject = txt.Text End If Case "System.Web.UI.WebControls.CheckBox" Dim chk As CheckBox = CType(c, CheckBox) If chk.ID.ToLower = "checkboxcc" Then If chk.Checked Then sendCC = True Else msgBody.Append(chk.ID & ": " & chk.Checked & vbCrLf & vbCrLf) End If Case "System.Web.UI.WebControls.RadioButton" Dim rad As RadioButton = CType(c, RadioButton) msgBody.Append(rad.ID & ": " & rad.Checked & vbCrLf & vbCrLf) Case "System.Web.UI.WebControls.DropDownList" Dim ddl As DropDownList = CType(c, DropDownList) msgBody.Append(ddl.ID & ": " & ddl.SelectedValue & vbCrLf & vbCrLf) End Select Next msgBody.AppendLine() msgBody.Append("Browser: " & Request.UserAgent & vbCrLf & vbCrLf) msgBody.Append("IP Address: " & Request.UserHostAddress & vbCrLf & vbCrLf) msgBody.Append("Server Date & Time: " & DateTime.Now & vbCrLf & vbCrLf) Dim myMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage() myMessage.To.Add(SendResultsTo) myMessage.From = New System.Net.Mail.MailAddress(FromEmail) myMessage.Subject = MailSubject myMessage.Body = msgBody.ToString myMessage.IsBodyHtml = False If sendCC Then myMessage.CC.Add(FromEmail) Dim basicAuthenticationInfo As New System.Net.NetworkCredential(smtpUsername, smtpPassword) Dim MailObj As New System.Net.Mail.SmtpClient(smtpMailServer) MailObj.Credentials = basicAuthenticationInfo MailObj.Send(myMessage) Me.YourForm.ActiveViewIndex = 1 Catch Me.YourForm.ActiveViewIndex = 2 End Try End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) If Not Page.IsPostBack Then Dim lbl As Label = Me.FormContent.FindControl("labelq") If lbl IsNot Nothing Then Dim rq(3) As String rq(0) = "Is fire hot or cold?" rq(1) = "Is ice hot or cold?" rq(2) = "Is water wet or dry?" Dim ra(3) As String ra(0) = "hot" ra(1) = "cold" ra(2) = "wet" Dim rnd As New Random Dim rn As Integer = rnd.Next(0, 3) lbl.Text = rq(rn) ViewState("hf1") = ra(rn) End If End If End Sub </script> <form id="form1" runat="server"> <asp:MultiView ID="YourForm" runat="server" ActiveViewIndex="0"> <asp:View ID="FormContent" runat="server"> <label for="Email"> Enter your Email Address:<br /> <asp:TextBox ID="Email" runat="server" Columns="35"> </asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="Email" Display="Dynamic" ErrorMessage="Please enter your email address." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="Email" ErrorMessage="Please enter a valid email address." SetFocusOnError="True" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" CssClass="ValidateMessage" ForeColor="">* Please enter a valid email address.</asp:RegularExpressionValidator> <br /> <br /> <label for="Subject"> Subject:<br /> <asp:TextBox ID="Subject" runat="server" Columns="50"> </asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="Subject" ErrorMessage="Please enter a subject." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <br /> <br /> <label for="Message"> Please type your message below: <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="Message" ErrorMessage="Please enter a message" SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <br /> <asp:TextBox ID="Message" runat="server" TextMode="MultiLine" Columns="55" Rows="10"> </asp:TextBox> </label> <br /> <br /> <label for="Category"> Category:<br /> <asp:DropDownList ID="Category" runat="server"> <asp:ListItem Value="none">select...</asp:ListItem> <asp:ListItem>Sales Question</asp:ListItem> <asp:ListItem>Customer Support</asp:ListItem> <asp:ListItem>Information Request</asp:ListItem> <asp:ListItem>Report a problem</asp:ListItem> <asp:ListItem>Make a comment</asp:ListItem> <asp:ListItem>Other</asp:ListItem> </asp:DropDownList> </label> <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="Category" ErrorMessage="Please select a category." Operator="NotEqual" ValueToCompare="none" SetFocusOnError="True" CssClass="ValidateMessage" ForeColor=""> * Please select a category.</asp:CompareValidator> <br /> <br /> <label for="First_Name"> First Name:<br /> <asp:TextBox ID="First_Name" runat="server" Columns="35"></asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="First_Name" ErrorMessage="Please enter your first name." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <br /> <br /> <label for="Last_Name"> Last Name:<br /> <asp:TextBox ID="Last_Name" runat="server" Columns="35"> </asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="Last_Name" ErrorMessage="Please enter your last name." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <br /> <br /> <label for="Title"> Title:<br /> <asp:TextBox ID="Title" runat="server" Columns="35"> </asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidatorTitle" runat="server" ControlToValidate="Title" ErrorMessage="Please enter your title." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <br /> <br /> <label for="Organization"> Organization:<br /> <asp:TextBox ID="Organization" runat="server" Columns="35"> </asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidatorOrganization" runat="server" ControlToValidate="Organization" ErrorMessage="Please enter your organization." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <br /> <br /> <label for="Phone"> Phone Number:<br /> <asp:TextBox ID="Phone" runat="server" Columns="40"> </asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="Phone" Display="Dynamic" ErrorMessage="Please enter your phone number." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="Phone" ErrorMessage="Please enter a valid U.S. phone number (including dashes)." SetFocusOnError="True" ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}" CssClass="ValidateMessage" ForeColor="">* Please enter a valid U.S. phone number (including dashes).</asp:RegularExpressionValidator> <br /> <br /> <label for="Fax"> Fax:<br /> <asp:TextBox ID="Fax" runat="server" Columns="40"> </asp:TextBox> </label> <br /> <br /> <label for="Website"> Website:<br /> <asp:TextBox ID="website" runat="server" Columns="40"> </asp:TextBox> </label> <br /> <br /> <label for="Street"> Street:<br /> <asp:TextBox ID="Street" runat="server" Columns="60"> </asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="Street" ErrorMessage="Please enter your street." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <br /> <br /> <label for="City"> City:<br /> <asp:TextBox ID="City" runat="server" Columns="60"> </asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="City" ErrorMessage="Please enter your city." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <br /> <br /> <label for="State"> State:<br /> <asp:DropDownList ID="State1" runat="server"> <asp:ListItem Value="none">select...</asp:ListItem> <asp:ListItem Value="AL">Alabama</asp:ListItem> <asp:ListItem Value="AK">Alaska</asp:ListItem> <asp:ListItem Value="AZ">Arizona</asp:ListItem> <asp:ListItem Value="AR">Arkansas</asp:ListItem> <asp:ListItem Value="CA">California</asp:ListItem> <asp:ListItem Value="CO">Colorado</asp:ListItem> <asp:ListItem Value="CT">Connecticut</asp:ListItem> <asp:ListItem Value="DC">District of Columbia</asp:ListItem> <asp:ListItem Value="DE">Delaware</asp:ListItem> <asp:ListItem Value="FL">Florida</asp:ListItem> <asp:ListItem Value="GA">Georgia</asp:ListItem> <asp:ListItem Value="HI">Hawaii</asp:ListItem> <asp:ListItem Value="ID">Idaho</asp:ListItem> <asp:ListItem Value="IL">Illinois</asp:ListItem> <asp:ListItem Value="IN">Indiana</asp:ListItem> <asp:ListItem Value="IA">Iowa</asp:ListItem> <asp:ListItem Value="KS">Kansas</asp:ListItem> <asp:ListItem Value="KY">Kentucky</asp:ListItem> <asp:ListItem Value="LA">Louisiana</asp:ListItem> <asp:ListItem Value="ME">Maine</asp:ListItem> <asp:ListItem Value="MD">Maryland</asp:ListItem> <asp:ListItem Value="MA">Massachusetts</asp:ListItem> <asp:ListItem Value="MI">Michigan</asp:ListItem> <asp:ListItem Value="MN">Minnesota</asp:ListItem> <asp:ListItem Value="MS">Mississippi</asp:ListItem> <asp:ListItem Value="MO">Missouri</asp:ListItem> <asp:ListItem Value="MT">Montana</asp:ListItem> <asp:ListItem Value="NE">Nebraska</asp:ListItem> <asp:ListItem Value="NV">Nevada</asp:ListItem> <asp:ListItem Value="NH">New Hampshire</asp:ListItem> <asp:ListItem Value="NJ">New Jersey</asp:ListItem> <asp:ListItem Value="NM">New Mexico</asp:ListItem> <asp:ListItem Value="NY">New York</asp:ListItem> <asp:ListItem Value="NC">North Carolina</asp:ListItem> <asp:ListItem Value="ND">North Dakota</asp:ListItem> <asp:ListItem Value="OH">Ohio</asp:ListItem> <asp:ListItem Value="OK">Oklahoma</asp:ListItem> <asp:ListItem Value="OR">Oregon</asp:ListItem> <asp:ListItem Value="PA">Pennsylvania</asp:ListItem> <asp:ListItem Value="RI">Rhode Island</asp:ListItem> <asp:ListItem Value="SC">South Carolina</asp:ListItem> <asp:ListItem Value="SD">South Dakota</asp:ListItem> <asp:ListItem Value="TN">Tennessee</asp:ListItem> <asp:ListItem Value="TX">Texas</asp:ListItem> <asp:ListItem Value="UT">Utah</asp:ListItem> <asp:ListItem Value="VT">Vermont</asp:ListItem> <asp:ListItem Value="VA">Virginia</asp:ListItem> <asp:ListItem Value="WA">Washington</asp:ListItem> <asp:ListItem Value="WV">West Virginia</asp:ListItem> <asp:ListItem Value="WI">Wisconsin</asp:ListItem> <asp:ListItem Value="WY">Wyoming</asp:ListItem> </asp:DropDownList> </label> <asp:CompareValidator ID="CompareValidatorState" runat="server" ControlToValidate="State" ErrorMessage="Please select a state." Operator="NotEqual" ValueToCompare="none" SetFocusOnError="True" CssClass="ValidateMessage" ForeColor=""> * Please select a state.</asp:CompareValidator> <br /> <br /> <label for="State"> State/Province:<br /> <asp:TextBox ID="State" runat="server" Columns="60"> </asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="State" ErrorMessage="Please enter your state/province." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <br /> <br /> <label for="Zip"> Zip/Postal Code:<br /> <asp:TextBox ID="Zip" runat="server" Columns="40"></asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="Zip" Display="Dynamic" ErrorMessage="Please enter your zip/postal code." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="Zip" ErrorMessage="Please enter a valid U.S. zip code." ValidationExpression="\d{5}(-\d{4})?" SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Please enter a valid U.S. zip code.</asp:RegularExpressionValidator> <br /> <br /> <label for="Country"> Country/Region:<br /> <asp:TextBox ID="Country" runat="server" Columns="60"> </asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="Country" ErrorMessage="Please enter your country." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <br /> <br /> <label for="TextBoxQ"> Anti-Spam Question: <asp:Label ID="LabelQ" runat="server"></asp:Label> <asp:TextBox ID="TextBoxQ" runat="server" Columns="8"></asp:TextBox> </label> <asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="TextBoxQ" Display="Dynamic" ErrorMessage="Please answer the anti-spam question." SetFocusOnError="True" CssClass="ValidateMessage" ForeColor="">* Required</asp:RequiredFieldValidator> <br /> <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" ShowSummary="False" CssClass="ValidateMessage" ForeColor="" /> <br /> <br /> <asp:CheckBox ID="CheckBoxCC" runat="server" Text="Send me a carbon copy of this email." /> <br /> <br /> <asp:Button ID="SubmitForm" runat="server" OnClick="SubmitForm_Click" Text="Submit Form" /> <br /> </asp:View> <asp:View ID="FormConfirmationMessage" runat="server"> Your message has been sent. Thank you for contacting us.<br /> </asp:View> <asp:View ID="FormErrorMessage" runat="server"> Due to technical difficulty, your message may NOT have been sent. </asp:View> <asp:View ID="FormSpamMessage" runat="server"> You did not correctly answer the anti-spam question. Please go back and try again.</asp:View> </asp:MultiView> </form> </body> </html>
|
|
|
|
wilbilj
Posts: 52 Joined: 2/19/2004 Status: online
|
RE: Contact form generator for expression - 9/30/2009 4:30:28
here is how I have it set up and it works fine: Dim SendResultsTo As String = "me@mydomain.net" Dim smtpMailServer As String = "mail.mydomain.net" Dim smtpUsername As String = "me@mydomain.net" Dim smtpPassword As String = "password" FYI - I'm not using godaddy as my host
|
|
|
|
andyrcampbell
Posts: 1 Joined: 10/16/2009 Status: offline
|
RE: Contact form generator for expression - 10/16/2009 12:56:52
I am having the same issue with the same form - have you found a solution yet ? I have a strange one though: If the e-mail address ends in .net then the form will not work but if the e-mail ends in .com then the form works
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|