This seems like I only need a line or two of code?
This is what I need to do:
- Add data validation to the new phone field on the Contact Us form. We would only accept phones with the following format: 995-999-9999
- Complete the contact us form so that you can submit it as an email. Send all your test emails to [email protected]. You can use any email account you have to send the email.
This needs programming APIs such as:
- System.Net.Mail
- MailMessage
- SmtpClient
- NetworkCredential
It seems easy but I am so very lost with it. Also this page does not show up when I run it. This is the page code: I hope I did it right, sorry if it is not correct. I am trying!
<%@ Page Title="Contact Us" Language="vb" AutoEventWireup="false" MasterPageFile="~/Main.Master" CodeBehind="ContactUs.aspx.vb" Inherits="Week10.ContactUs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>Contact Us</h1>
<hr />
<table border="1">
<tr>
<td>From</td>
<td>
<asp:TextBox ID="txtFrom" runat="server" Width="400px"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="rfvFrom" CssClass="ErrMSG" runat="server" ControlToValidate="txtFrom" ErrorMessage="*" ToolTip="From field is required"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>Subject</td>
<td>
<asp:TextBox ID="txtSubject" runat="server" Width="400px"></asp:TextBox>
</td>
<td><asp:RequiredFieldValidator ID="rfvSubject" CssClass="ErrMSG" runat="server" ControlToValidate="txtSubject" ErrorMessage="*" ToolTip="Subject field is required"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>Phone</td>
<td>
<asp:TextBox ID="txtPhone" runat="server" Width="100px"></asp:TextBox>
</td>
<td><asp:RequiredFieldValidator ID="rfvPhone" CssClass="ErrMSG" runat="server" ControlToValidate="txtPhone" ErrorMessage="*" ToolTip="Phone field is required"></asp:RequiredFieldValidator>
</td>
</tr>
<tr valign="top">
<td>Comments</td>
<td>
<asp:TextBox ID="txtComments" runat="server" Rows="10" TextMode="MultiLine"
Width="400px"></asp:TextBox>
</td>
<td><asp:RequiredFieldValidator ID="rfvComments" CssClass="ErrMSG" runat="server" ControlToValidate="txtComments" ErrorMessage="*" ToolTip="Comments field is required"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td colspan="3" align="center">
<asp:Button ID="btnSubmit" runat="server" Text="Submit" /></td>
</tr>
<tr>
<td colspan="3" align="center">
<asp:Label ID="lblMSG" runat="server" Text=""></asp:Label>
</td>
</tr>
</table>
</asp:Content>