Email problem, someone please help!!


I'm making a website in and on the last task ive come across a problem :(, here it is!

page1.aspx has a detailsview grid with a button for each line, when you click the button it takes all the information for that line to another page and seperates it into labels. That works fine no worries.

But the reason for this page is so i can email all the information in the labels to a email address, when i send it, it does go through to the email but doesnt display the information called from the detailsview but instead the label name (text="label1") if i delete the text tag it shows nothing. BELOW IS THE CODE

<%@ Import Namespace="System.Net.Mail" %>

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>

<script language="vb" runat="server">


Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

'create the mail message

Dim mail As New MailMessage()

mail.From = New MailAddress("Ross Hinton")


mail.Subject = "This is an email"

mail.Body = Label1.Text

mail.Attachments.Add(New Attachment(FileUpload1.PostedFile.InputStream, Label1.Text))

Dim smtp As New SmtpClient("")


End Sub


<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 135px; position: absolute; top: 13px" Font-Bold="True" ForeColor="White" Text="Label">


<asp:FileUpload ID="FileUpload1" runat="server" Style="z-index: 105; left: 131px; position: absolute; top: 161px" Width="228px" />

<asp:Button ID="Button1" runat="server" Style="z-index: 105; left: 130px; position: absolute; top: 182px" Text="Button" OnClick="Button1_Click"/>


11/13/2007 12:11:40 PM 93655 articles. 5 followers. Follow

5 Replies

Similar Articles

[PageSpeed] 16

Add this line below your  mail.Subject line.

mail.IsBodyHtml = True

11/13/2007 12:21:34 PM

Tried it and it didnt work still got the same problem.

Has anyone got any ideas??


11/13/2007 1:21:45 PM

I'm not 100% sure I understand what is happening that you don't want to happen. Are you saying that you want the email body to have the value from the Request.QueryString("JobTitle") and instead it has the text "Label"? If that is the case it is because you are setting mail.Body to Label1.Text and Label1.Text you set to the string "Label". If you want mail.Body to have the value from the query string then you need to set your label like this:

<asp:label ID="Label1" runat="server" style="..." Text='<%=Request.QueryString("JobTitle")' />

Then when you set mail.Body = Label1.Text it will have the value from the query string.

If this post answered your question please remember to 'Mark as Answer'!
11/13/2007 2:02:09 PM

I tried it and i get

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Ive tried <%#Request

and also <%response.write(request.querystring("jobtitle")


any ideas?????????


11/13/2007 2:28:57 PM

Oh, well put a Page_Load handler in your code and set Label1.Text = Request.QueryString(...) in there instead.

If this post answered your question please remember to 'Mark as Answer'!
11/13/2007 2:59:28 PM

Similar Artilces:

Desperate Visual Studio .NET problem with Web Forms, please help
Hi, I've posted in the past about this problem and got no response, but now I'm desperate so have to try again. In Visual Studio .NET 2003, with .NET Framework 1.1, all web form controls (in fact all controls in the toolbar) are disabled. I create a webform.aspx page, I am in design view, but when I go to the "web forms" toolbar, I cannot drag anything to the page. I solved this last time by completely wiping my drive and spending three days reinstalling and updating everything. Everything in Visual Studio worked as expected for a few days, and now yet again everything is disabled. Can s...

Please Help!! web parts and .net forms
This is a two part question. 1. i have a simple .net form that captures users input and i want to post to another form to show users input and data from a database into a data grid. In keep posting back to the first form. I have action and method set correctly on my first form, no idea why it post to same form. i even have a response.redirect in the click event of the button on the first form. 2. Does anyone know of any good site/web cast that step you through a basic web part for sharepoint 2007 i am using both visual studio 2005 and 2008. I heard that it is like a 12 step ...

Problem with web forms in subdirectories
Here's my problem: I have a web app that is made up of a few different forms. The directory structure is pretty simple. My root directory is called maintenance and there is another directory underneath it called admin. I have some web forms in each directory. The plan is to use a separate web.config file in the admin subdirectory so I can perform Windows authentication on any files in the admin directory. I have both the maintenance and admin directories setup in IIS as applications, and I have a simple web.config file in the admin directory that looks like this (for testing purpose...

Web Matrix Forms problem.. Need Expert Help Please!
Hello.. I'm new to ASP.NET and Web Matrix, and maybe I'm approaching something wrong, but need the experts help here.. I have a web site which is hosted at a remote hosting company.. I also have an SQL server hosted at the same company.. Well, I'm trying to write a form that will use the DB.. When ever I add a Web Control such as a Text Box or Label, etc.. I thought that Web Matrix would automatically put the "<Form runat="server"> around the web server controls, but it doesn't..</form>, so I did so.. Saved the page and since I'm using a remote host, I have...

VS.NET Web App messing up form authentication? Help, please?
Does anyone know of any problems with creating a VS.NET Web App in a forms authenticated subfolder? I created a Web App "pics" with VS.NET as a subfolder of wwwroot, and the Request.ServerVariables("AUTH_USER") is always blank on all the pages in this subfolder wwwroot/pics. I deleted the VS.NET premade Web.Config file so that there is only the one file at wwwroot, but that didn’t help. Are there any other files created by VS.NET that could be messing this up? I made other ASPX subfolders outside of VS.NET and they all continue the session just fine, it's like this ...

Funny character being added instead of spaces in .net web forms...please help
Hi,in all of my pages I have the following html code:&nbsp;&lt;TD class=padding colSpan=2 height=23&gt;&lt;div align="center"&gt;&lt;A &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; href="#"&gt;Privacy Policy&lt;/A&gt; »&lt;a href="#"&gt; Terms of Use&lt;/a&gt;&lt;/div&gt;&lt;/TD&gt;on my default.aspx page, this gets displayed as: Privacy Policy » Terms of Useand the code isPrivacy Policy » Terms of UseCan ...

I cannot get my C#.NET Email Form to work on Godaddy hosting account. Please Help!!!!
Hello;   I have created a contact us page and I am using .NET Mail classes to send the form via email. However I keep getting this error when I upload my info to the hosting server... Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Oh and yes, it wont send any emails. here is my code... using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.Web...

send web email from web form error help
Hi, When send email with attachment from web form. I got an error message as below. What it is? Can someone help? Server Error in '/dotNet' Application. -------------------------------------------------------------------------------- The transport lost its connection to the server. Hi There, Please check the following link The transport failed to connect to the server Hope this helps Sunny NAGIProper Preparation Prevents Poor PerformanceDont forget to click "Mark as Answer" on the post that helped you....

Error While Uploading image to my Web Folder Vie Web Form, Please Help
Hi i am getting this error when i am trying to upload image to my website folder, its showing this error System.IO.FileNotFoundException: F:\gotnet\ASP_NET Full Article Listing Creating Dynamic Data Entry User Interfaces_files\arrowLTR.gif at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement) at System.Drawing.Image.FromFile(String filename) at Af.AfnanSchool.InsertVB.Connection.SaveImage(String FileName, DateTime JoinDate, String StrPath) and also my validation is not working, but it was working fine on my local pc, please help thanks in advan...

Help with web form please
Hello everyone. From a current web form I need to open another web form using a button.Please tell me what I should use to perform it.I'm programming in C# Thanks a lot. My best regards to use a text/image link you would use:<a href="MyNewForm.ASPX" target="_blank">Open New Web Form</a>--------------------------------------------------------Don't forget to click "Mark as Answer" on the post(s) that helped you.NHibernate with Problem-Design-Solution sample applicationScott blog

Email from Web Form problems
I am emailing a link that is created from a web form that we have.  The email is sent and some of the characters at the end of the link are chopped off the link.  Is there a way to fix this? Can you provide a sample of your code? I have seen something like this happen before to characters in a string. I overcame it by encoding the string before sending it. Regards Aaron  What did you encode the string as?  Is there a way you could give me an example? Below is a sample of my code.  Sorry I did not post this earlier for you.     if not isempty(Req...

Hello everyone! I have an unresolved issue that is haunting me and I am in serious doo doo cause my site is not functioning!!!!  The problem that is haunting me is an asp form-mailer.  I've used MS Visual Web 2005 to build a very simple site, and I mean simple (3 pages, with a customer request submission form).  My hosting company uses a specific form-mailer to capture and send email from the server.  Where I need help is that I don't understand, nor know how to finish my request submission form so it will link to their's to process the email.  Their instructions ar...

can someone one give me difference between web form and mobile web form and which or where or when i'm using the forms?
thanks Marc Hi Marc, Based on my understanding, you want to know the differences between the ASP.NET web application and ASP.NET mobile web application. If I have misunderstood you, please feel free to let me know. The ASP.NET forms are used to develop the ASP.NET pages for desktop browsers and The ASP.NET mobile forms are used to develop the ASP.NET pages for mobile device browsers. When we create the ASP.NET mobile web forms pages, we can use nearly all the features of ASP.NET. But there are a couple of compatibility issues: Error Handling and Reporting. Tracing. Using Redi...

Email delivery problems from web form
hello -I have a web feedback form that sends an email to me on submitting the form. However, if i use an aol or other domains as the recipient email address, the email is not being delivered. If I use my yahoo address, i receive emails from the form without any problems.  any help with this issue would be greatly appreciated? Or is this a SMTP IIS issue that someone can help me with?Thanks,Dino Try posting the code where you create and send the email message...::smtraber::..Victory is mine!!...

Web resources about - Email problem, someone please help!! -

Is–ought problem - Wikipedia, the free encyclopedia
The is–ought problem in meta-ethics as articulated by Scottish philosopher and historian David Hume (1711–76) is that many writers make claims ...

The problem with the RBA's terms-of-trade forecasts
Most commodity markets have proved too reactionary to offer much insight into future price developments.

6 problems with the Moto X Play and how to fix them
... every other smartphone and tablet out there, the Moto X Play is not without its issues. Which is why, we've rounded up some of the common problems ...

Report claims Samsung Galaxy S7 will fix the biggest problem with the Galaxy S6
... Samsung ditched microSD support on the Galaxy S6. Well according to a new report on Monday, Samsung will fix the bigger of those two problems ...

DeAndre Hopkins Having No Problem with Darrelle Revis, Burns Him for 61-Yard TD - Bleacher Report
Many believed Houston Texans wide receiver DeAndre Hopkins would be stranded on Revis Island this Sunday. He hasn’t been—at all...

"So the product is being deliberately misused despite a specific warning label, and y'all are complaining ...
"Nobody was irreparably broken or even like stubbed their toe? BURN BUNCH EMS DOWN. Bomb this company back to the stone age before the hair of ...

Oil Patch Problems: Rigs Down 60%, Production Down 3%, $40-$50 Price Doesn't Work
... has not hand a monthly close below $40 since mid-2004. And $40 to $50 is not even profitable, putting producers into a bind. Oil Patch Problems ...

There's a big problem with the iPad Pro that could ruin its main selling point
... iPad Pro's launch has been mired by the long shipping times for key accessories, such as the Pencil and Smart Keyboard, and a charging problem ...

Acampora on problems in the market
Master technician Ralph Acampora says he has some doubts about this "fractured" market.

Tesla Unveils ‘Cheap’ $80,000 SUV, As Problems Mount For The Automaker
Tesla unveiled an $80,000 “budget” version of its Tesla Model X SUV Tuesday as the company struggles to sell cars and burns through cash at an ...

Resources last updated: 11/25/2015 9:58:56 AM