通过电子邮件提交注册表 [英] submit registration form by email

查看:87
本文介绍了通过电子邮件提交注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在此页面上有用户注册signup.aspx,我希望将字段通过电子邮件发送给管理员,以便他们可以手动设置新用户。在收到管理员发送的确认电子邮件之前,用户将无法使用其会员资格。

If I have a user register on this page signup.aspx, I want to fields to be emailed to the admin so that they can manually set up the new user. The user will not be able to use their membership until they have received a confirmation email from the admin.

我知道有更好的方法可以做到这一点,但这是如何做到的完成。

I know there is a better way to do this, but this is how it is to be done.

我的代码如下为signup.aspx

My code below for the signup.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="signup.aspx.cs" Inherits="index1.signup2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Audit Services Signup</title>
       <script type="text/javascript" language="javascript">

           function yes() {

               MMDiv.style.visibility = 'visible';

               MMDiv2.style.visibility = 'visible';

               txt_client.style.visibility = 'hidden';

               lbl_client.style.visibility = 'hidden';

               form1.CarrierScac.focus();

           }

           function no() {

               MMDiv.style.visibility = 'hidden';

               MMDiv2.style.visibility = 'hidden';

               txt_client.style.visibility = 'hidden';

               lbl_client.style.visibility = 'hidden';

           }

           function client() {

               txt_client.style.visibility = 'visible';

               lbl_client.style.visibility = 'visible';

               MMDiv.style.visibility = 'hidden';

               MMDiv2.style.visibility = 'hidden';

               form1.clientname.focus();

           }

</script>

    <style type="text/css">
        .style1
        {
            font-size: small;
            color: #000080;
        }
        .style2
        {
            color: #000080;
        }
        .style5
        {
            width: 156px;
        }
        .style6
        {
            color: #000080;
            width: 137px;
        }
        .style7
        {
            width: 137px;
        }
        .style8
        {
            color:#FF0000;
            width: 137px;
        }
            
    </style>

</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >



	

	<tr>

		<td><img src="http://www.company.com/images/spacer.gif" height="1" width="20" alt="line" />A  Division</td>

		

		<!-- Display Date -->

<script type="text/javascript" language="JavaScript">

<!--    Begin

    d = new Array(

"Sunday",

"Monday",

"Tuesday",

"Wednesday",

"Thursday",

"Friday",

"Saturday"

);

    m = new Array(

"January",

"February",

"March",

"April",

"May",

"June",

"July",

"August",

"September",

"October",

"November",

"December"

);



    today = new Date();

    day = today.getDate();

    year = today.getYear();



    if (year < 2000)

        year = year + 1900;



    end = "th";

    if (day == 1 || day == 21 || day == 31) end = "st";

    if (day == 2 || day == 22) end = "nd";

    if (day == 3 || day == 23) end = "rd";

    day += end;



    document.write("<font face='Verdana, Arial, Helvetica' size='1'>");

    document.write(d[today.getDay()] + ", " + m[today.getMonth()] + " ");

    document.write(day + ", " + year);

    document.write("</font><img src='http://www.logisource.com/images/spacer.gif' height='1' width='20'>");

// End -->24.224.117.67

</script>	

</tr>
      <tr><td valign="top" colspan="2"><img src="http://www.company.com/images/line.gif" height="1" width="100%" alt = "line" /></td></tr>
 </table>







	<!-- ***************** Main Cell For Body ******************* -->	

			
   <table width="100%" border="0" >
     <tr>
        <td align="center"><br />		
   <table width="100%" >
    <tr>
       <td align="center">

    <form id="form1" runat="server">
    <div>
        <table border="0"  cellpadding="0" cellspacing="1" 
            style="border-style: solid; border-color: #C0C0C0; border-width: 2px 20px 2px 20px; background-color: #EBEDEC;">
       <tr>
          <td>
    <table width="95%" >
       <tr>
          <td align="center">
    <table border="0" cellpadding="1" width="95%"  >
        <tr> 
          <td colspan="2" align="center">&nbsp;<strong style="color: #000080">New User Account Setup</strong><br /><br />
                                                       <span class="style1">*Your IP Address Is Being Tracked For Security Purposes</span><br 
                  class="style1" />&nbsp;</td>
        </tr>
        <tr> 
          <td align="right" class="style6">IP Address:&nbsp;&nbsp;</td>
          <td class="style5">
              <asp:Label ID="Label3" runat="server" Text=""></asp:Label></td>
        </tr>
        <tr> 
          <td align="left" valign="middle" class="style6">Are you a Delta&nbsp;&nbsp;&nbsp;&nbsp; Audit:&nbsp;&nbsp;</td>
          <td class="style5">
              <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" 
                  Height="25px" Width="108px" 
                  onselectedindexchanged="RadioButtonList1_SelectedIndexChanged" 
                  RepeatDirection="Horizontal">
                  <asp:ListItem Text="Client" Value="Client" Selected="False"></asp:ListItem>
                  <asp:ListItem Text="Carrier" Value="Carrier" Selected="False"></asp:ListItem>               
              </asp:RadioButtonList>
          </td>
         </tr>            
        <tr>            
            <td class="style6" align="right">
                <asp:Label ID="Label1" runat="server" Text=""></asp:Label></td>
                <td><asp:TextBox ID="tbClient" runat="server" Visible="false" ></asp:TextBox>
                </td>
                </tr>
                <tr>
                  <td class="style6" align="right">
                 <asp:Label ID="Label2" runat="server" Text=""></asp:Label></td>
                  
                 </tr>     
                  <tr> 
           <td align="right" class="style7">
               <asp:Label ID="lbl_name" runat="server" Text="Name:" CssClass="style2"></asp:Label></td>
           <td class="style5"><asp:TextBox ID="txt_name" runat="server" CssClass="style2"></asp:TextBox></td>
        </tr>
         <tr> 
           <td align="right" class="style7">
               <asp:Label ID="lbl_company" runat="server" Text="Company Name:" CssClass="style2"></asp:Label></td>
           <td class="style5">
               <asp:TextBox ID="txt_company" runat="server" CssClass="style2"></asp:TextBox></td>
        </tr>
        <tr> 
           <td align="right" class="style7">
               <asp:Label ID="lbl_address" runat="server" Text="Address:" CssClass="style2"></asp:Label></td>
           <td class="style5">
               <asp:TextBox ID="txt_address" runat="server" CssClass="style2"></asp:TextBox></td>
        </tr>
        <tr> 
          <td align="right" class="style7"><asp:Label ID="lbl_city" runat="server" Text="City" 
                  CssClass="style2"></asp:Label></td>
          <td class="style5"><asp:TextBox ID="txt_city" runat="server" CssClass="style2"></asp:TextBox></td>
       </tr>
       <tr> 
           <td align="right" class="style7">
               <asp:Label ID="lbl_state" runat="server" Text="State" CssClass="style2"></asp:Label></td>
           <td class="style5">
               <asp:DropDownList ID="ddl_state" runat="server" CssClass="style2">
                                        <asp:ListItem Value=""> </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="DE">Delaware</asp:ListItem> 

                                        <asp:ListItem Value="DC">District of Columbia</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&nbsp;</asp:ListItem> 

                                        <asp:ListItem Value="MA">Massachusetts</asp:ListItem> 

                                        <asp:ListItem Value="MI"></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></td>
      </tr>
      <tr> 
         <td align="right" class="style7"><asp:Label ID="lbl_zipcode" runat="server" Text="Zip Code:" 
                 CssClass="style2"></asp:Label></td>
            <td class="style5"><asp:TextBox ID="txt_zipcode" runat="server" CssClass="style2"></asp:TextBox></td>
      </tr>
      <tr> 
        <td 
            align="right" class="style7"><asp:Label ID="lbl_phone" runat="server" Text="Phone Number:" 
                CssClass="style2"></asp:Label></td>
            <td class="style5"><asp:TextBox ID="txt_phone" runat="server" CssClass="style2"></asp:TextBox></td>
      </tr>
      <tr> 
         <td 
            align="right" class="style7"><asp:Label ID="lbl_email" runat="server" Text="Email:" 
                 CssClass="style2"></asp:Label></td>
            <td class="style5"><asp:TextBox ID="txt_email" runat="server" CssClass="style2"></asp:TextBox></td>
      </tr>
      <tr> 
         <td colspan="2" align="center"><br class="style2" />&nbsp;<span class="style1"><strong>Please select a Username and Password.</strong></span></td>
      </tr>
      <tr> 
        <td align="right" class="style7"><asp:Label ID="lbl_username" runat="server" Text="Username:" 
                CssClass="style2"></asp:Label></td>
            <td class="style5"><asp:TextBox ID="txt_username" runat="server" CssClass="style2"></asp:TextBox></td>
      </tr>
      <tr> 
         <td 
            align="right" class="style7"><asp:Label ID="lbl_password" runat="server" Text="Password:" 
                 CssClass="style2"></asp:Label></td>
            <td class="style5"><asp:TextBox ID="txt_pass" TextMode="Password" runat="server" CssClass="style2"></asp:TextBox></td>
      </tr>
      <tr> 
         <td colspan="2" align="center"><br/><asp:Button ID="btn_submit" runat="server" 
                 Text="Submit" style="color: #000080; font-weight: 700" 
                 onclick="btn_submit_Click"></asp:Button></td> 

          
              </tr>
</table>
<br />
</td>
</tr>
</table>
</td>
</tr>
</table>

    </div>
    </form>
    <br />

If you have difficulty accessing the system or cannot remember your username and password, please contact Logisource Support via email at <a href="mailto:support@company.com">support@company.com</a>.

<br /><br />

<em>Unauthorized access to this system is strictly prohibited.</em>

br />br />

<div >&nbsp;Contents Copyright © 2003 Company. All rights reserved.</div>	
</td>
</tr>
</table>
</td>
</tr>
</table>

</body>
</html>

以及代码隐藏

using System.Collections;
using System.Configuration;
using System.Data;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;


namespace index1
{
    public partial class signup2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Label3.Text = Request.UserHostAddress;
        }

        protected void btn_submit_Click(object sender, EventArgs e)
        {
            
            Response.Redirect("newAccount.aspx");
            Session["Cust_Name"] = txt_username.Text;

        }

        protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (string.Equals(RadioButtonList1.SelectedValue, "Client"))
            {
                Label1.Text = "Client Name:";
                tbClient.Visible = true;
            }
            if (string.Equals(RadioButtonList1.SelectedValue, "Carrier"))
            {
                Label1.Text = "Carrier SCAC:";
                tbClient.Visible = true;
            }

        }

    }
}

推荐答案

您可以使用
SmtpClient
,用于准备和发送来自submit_click事件处理程序的电子邮件。 msdn上的文档有一个示例,说明了它是如何完成的。

You can use SmtpClient to prepare and send an email from the submit_click event  handler. The documentation on msdn has an example that shows how it's done.


这篇关于通过电子邮件提交注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆