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 6573381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:07:32+00:00 2026-05-25T15:07:32+00:00

I have a report created thru an ASP.NET table and I want to send

  • 0

I have a report created thru an ASP.NET table and I want to send an email message containing this report in the body of the message not as an attachment including the table layout and content. How can this be done in c#? Thank you Dov

  • 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-05-25T15:07:32+00:00Added an answer on May 25, 2026 at 3:07 pm

    I put together the following code from an article at this site http://authors.aspalliance.com/stevesmith/articles/dotnetemailwebsite.asp which I found thru a question asked here “Best way to create complex html email message with asp.net, how?”, and from this article How to Print in ASP.NET 2.0 http://www.dotnetcurry.com/ShowArticle.aspx?ID=92.
    I use an asp.net panel so that I can get only parts of the page and not the whole page so that you can send a table, in my case, without having to send the button which activates sending the email or any other part of the page which I don’t want to send.
    NOTE: Any style properties for controls sent must be set directly to the controls and not thru cssclass.
    This is the code:

    //Here I extract html of the control to be sent
    StringWriter stringWrite = new StringWriter();
    System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
    //pnlRpt is an asp.net panel containing the controls to be sent
    pnlRpt.RenderControl(htmlWrite);
    string htmlStr = stringWrite.ToString();
    
    //Here I send the message whith the html of the table
    MailMessage msg = new MailMessage();
    msg.From = new MailAddress("EmailOfSender");
    msg.To.Add("emailOfReceiver");
    msg.Subject = "your subject";
    msg.Body = htmlStr;
    msg.IsBodyHtml = true;
    SmtpClient smtp = new SmtpClient(mailServer);
    smtp.Credentials = new System.Net.NetworkCredential(userName, usePass);
    smtp.Send(msg);
    msg.Dispose();
    

    With this code I sent an asp.net table generated and populated in background code and it worked perfectly.

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

Sidebar

Related Questions

I have created this report using BIRT and phpjavabridge <?php header(Content-type: application/pdf); header(Content-Disposition: inline;
I have created a SSRS 2008 report.I have created a matrix.I want to make
I am making application in ASP.Net 2.0 in VS 2010, i have created crystal
I have created a report with the Eclipse BIRT plugin for Eclipse and want
I have created a report table. I have set it to display 5 rows
I have a report created in Jasper Reports which ONLY recognizes java.util.Date's (not Calendar
I am not an experienced APEX developer, hence this problem: I have a report
I have a report that I created with Crystal Reports 2008. This report uses
I have created a report in SSRS that contains 2 matrices (not tables/lists), each
I have a report document created by Microsoft Reporting but instead of using its

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.