Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7872691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:16:56+00:00 2026-06-03T02:16:56+00:00

I have an aspx form and there are bunch of textboxes, drowdownlists, checkboxes. When

  • 0

I have an aspx form and there are bunch of textboxes, drowdownlists, checkboxes. When this input controls are filled with necessary data I want to send this information as email. Let’s say I have a textbox that takes the applicant’s name, a dropdownlist that lists occupations and so foth. So I will want to have the email contain the same information, as

 Name:Anthony Brian 
 Occupation: Surgeon
 ......

How would I do this?

EDIT: Here’s the aspx in case somebody is interested:

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="WriteMail.aspx.cs"     
 Inherits="WriteMail" %>

 <!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 runat="server">
 <title></title>
 <style type="text/css">
    .style2
    {
        width: 203px;
    }
    .style3
    {
        width: 226px;
    }
    .style4
    {
    }
    .style6
    {
        width: 198px;
    }
    .style7
    {
        width: 204px;
    }
    </style>
    </head>
    <body>
   <form id="form1" runat="server">
   <div align="center" style="font-weight: bold; font-family: tahoma; font-size: 12px;
    margin-bottom: 10px;">
    Hörmətli istifadəçi!</div>
   <div align="center" style="font-family: tahoma; font-size: 12px;margin-bottom:   
   30px;">
    <span class="style2"><span class="style10">Azərbaycan Respublikası Dövlət Sosial  
   Müdafiə
        Fonduna məktub göndərmək ücün aşağıdakı formanı doldurun.(* - vacib sahələr)  
   </span></span></div>
  <div id="main">
    <table>
        <tr>
            <td class="style6">
                &nbsp;Adınız* :</td>
            <td class="style7">
                Soyadınız* :</td>
            <td class="style3">
                &nbsp;Atanızın adı*</td>
        </tr>

        <tr>
            <td class="style6">
                <asp:TextBox ID="TextBox2" runat="server" Width="182px"></asp:TextBox>
            </td>
            <td class="style7">
              &nbsp;<asp:TextBox ID="TextBox3" runat="server" Width="182px"></asp:TextBox>
            </td>
            <td class="style3">
                &nbsp;<asp:TextBox ID="TextBox4" runat="server" Width="182px"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td class="style6">
                &nbsp;</td>
            <td class="style7">
                &nbsp;</td>
            <td class="style3">
                &nbsp;</td>
        </tr>

        <tr>
            <td class="style6">
                &nbsp;Ölkə*:&nbsp;</td>
            <td class="style7">
              &nbsp;Şəhər*:&nbsp;</td>
            <td class="style3">
                &nbsp;&nbsp; &nbsp;</td>
        </tr>

        <tr>
            <td class="style6">
                <asp:TextBox ID="TextBox5" runat="server" Width="182px"></asp:TextBox>
            </td>
            <td class="style7">
                <asp:TextBox ID="TextBox6" runat="server" Width="182px"></asp:TextBox>
            </td>
            <td class="style3">
                &nbsp;</td>
        </tr>

        <tr>
            <td class="style6">
                &nbsp;</td>
            <td class="style7">
                &nbsp;</td>
            <td class="style3">
                &nbsp;</td>
        </tr>

        <tr>
            <td class="style6">
                &nbsp;Ünvan*:</td>
            <td class="style7">
                &nbsp;</td>
            <td class="style3">
                &nbsp;</td>
        </tr>

        <tr>
            <td class="style4" colspan="3">
                <asp:TextBox ID="TextBox7" runat="server" Width="602px"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td class="style6">
                &nbsp;</td>
            <td class="style7">
                &nbsp;</td>
            <td class="style3">
                &nbsp;</td>
        </tr>

        <tr>
            <td class="style6">
                Telefon kodu və nömrəsi*:</td>
            <td class="style7">
                Email*:</td>
            <td class="style3">
                &nbsp;</td>
        </tr>

        <tr>
            <td class="style6">
                <asp:TextBox ID="TextBox8" runat="server" Width="182px"></asp:TextBox>
            </td>
            <td class="style7">
                <asp:TextBox ID="TextBox9" runat="server" Width="182px"></asp:TextBox>
            </td>
            <td class="style3">
                &nbsp;</td>
        </tr>

        <tr>
            <td class="style6">
                &nbsp;</td>
            <td class="style7">
                &nbsp;</td>
            <td class="style3">
                &nbsp;</td>
        </tr>

        <tr>
            <td class="style6">
                Yaşınız*:</td>
            <td class="style7">
                Cinsiniz*:</td>
            <td class="style3">
                &nbsp;</td>
        </tr>

        <tr>
            <td class="style6">
                <asp:TextBox ID="TextBox10" runat="server" Width="66px"></asp:TextBox>
            </td>
            <td class="style7">
                <asp:CheckBoxList ID="CheckBoxList1" runat="server" 
                    RepeatDirection="Horizontal">
                    <asp:ListItem Value="1">Kişi</asp:ListItem>
                    <asp:ListItem Value="2">Qadın</asp:ListItem>
                </asp:CheckBoxList>
            </td>
            <td class="style3">
                &nbsp;</td>
        </tr>

    </table>
</div>
</form>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:16:59+00:00Added an answer on June 3, 2026 at 2:16 am

    you can use below code for getting details from your aspx page and sent it as email body.

    public string GetHtmlBody()
    {
        String strHTMLBody = String.Empty;
    
    
        if (TextBox2.Text.ToString().Trim() != "")
        {
            strHTMLBody = strHTMLBody + "Name : " + TextBox2.Text.ToString().Trim() + "<br/>"; 
        }
        if (TextBox3.Text.ToString().Trim() != "")
        {
            strHTMLBody = strHTMLBody + "Surname : " + TextBox3.Text.ToString().Trim() + "<br/>";
        }
        if (TextBox2.Text.ToString().Trim() != "")
        {
            strHTMLBody = strHTMLBody + "Occupation : " + TextBox4.Text.ToString().Trim();
        }
    
        // like wise you can get other details in same way in string variable.
    
        return strHTMLBody;
    
    }
    public bool SendEmail(string to, string subject)
    {
    
        // get the hostname of the SMTP server from Web.config
        string hostname = ConfigurationManager.AppSettings["SMTP"];
        // Example: add 
        //          to the  section of Web.config
        string user = ConfigurationManager.AppSettings["SMTP_user"];
        string pwd = ConfigurationManager.AppSettings["SMTP_pwd"];
    
        MailMessage mail = new MailMessage();
        mail.From = new MailAddress("your@email.com", "Name");
        mail.To.Add(to);
        mail.Subject = subject;
        mail.Body = GetHtmlBody();
        mail.IsBodyHtml = true ;
        SmtpClient client = new SmtpClient(hostname);
        client.Credentials = new System.Net.NetworkCredential(user, pwd);
        try
        {
            client.Send(mail);
            return true;
        }
        catch (Exception)
        {
            return false;
        }
    
    }
    

    Hope this will helps you…happy coding….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a web form aspx page that calls RegisterClientScriptBlock. This sends down
my structure is like this: master page aspx(web form) ascx(user control) I have a
I have many aspx page includes in my web form. I want to convert
I have the following code on my Home.aspx page: <form id=frmJump method=post action=Views/ViewsHome.aspx> <input
I have a .aspx Web Form with a .aspx.cs code-behind. The code-behind is nearly
I have a form in my aspx markup. I add to it some fields
I have a child page LoginContent.aspx which contains a login form. If the user
I have a .aspx page that loads three separate .ascx controls to represent adding,
I have a huge ASPX web form which has around 100 fields which need
I have a table with some ids, and i want in default.aspx to open

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.