473,320 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using an web page a a template for email on data submit.

I am trying to figure out if this is possible and how as I have burnt my
brain out today.

I have an application that submits data to a SQL database and an email is
generated for notifications on a portion of that data. I would like to create
a web page that I can reference as a variable sorta like this

using namespace.templates;

Notification notEmail = new Notification();

the based on however I need to submit my data be able to take notEmail and
translate to the HTMl and submit to the notification table this html in a
text field.

Then later my email process can process the text into and HTML email and
send it to the proper parties.

My issue is how to get the html by using the page template from and ASP.NET
project on submit.

Hope that makes sense.

Thanks in advance.
Nov 19 '05 #1
3 1570
If I understand you correctly, you're looking to create HTML page
template interspersed with data to be sent in email.Here is an approach
I have used.
1)Design an aspx page for your template with all the HTML you need and
Label/Literal controls for the data.This aspx page should implement
code to fill in the controls with the values posted to it.
2)Now when you need to send the email, use System.Net.HTTPWebRequest to
retrieve the ASPX page content after posting the required data to that
form.
3)Send the content in email.

HTH

Nov 19 '05 #2
Sorry I am a bit fried from serveral other things today and just am not
seeing it. Can you post an example of the code calling the page please.

Thansk very much in adavance.

"souri challa" wrote:
If I understand you correctly, you're looking to create HTML page
template interspersed with data to be sent in email.Here is an approach
I have used.
1)Design an aspx page for your template with all the HTML you need and
Label/Literal controls for the data.This aspx page should implement
code to fill in the controls with the values posted to it.
2)Now when you need to send the email, use System.Net.HTTPWebRequest to
retrieve the ASPX page content after posting the required data to that
form.
3)Send the content in email.

HTH

Nov 19 '05 #3
Here is some code. Hope this enough to get you started.

/// <summary>
/// Used to screen scrape a web page and get the HTML output.
/// This approach is employed to create rich HTML text used for the
notification templates.
/// </summary>
public string GetWebPageHTMLString(string url,NameValueCollection
nameValueCollection)
{
System.Net.WebClient wc = new WebClient();
wc.Credentials = CredentialCache.DefaultCredentials;

Byte[] htmlString = wc.UploadValues(url,"POST",nameValueCollection);
System.Text.UTF8Encoding oUTF8 = new System.Text.UTF8Encoding();
return oUTF8.GetString( htmlString);
}

You may call this like.
NameValueCollection _postData = new NameValueCollection();
_postData.Add("variable1",value1)
_postData.Add("variable2",value2);
string html=
GetWebPageHTMLString(url,_postData);

//Now email this HTML

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
4
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
0
by: lucas | last post by:
Hi, I have a simple input form that i use to add records to a sql server database. Bellow that is a datagrid that has one template column that I use to dispaly the 3 fields with some html...
1
by: Nick | last post by:
I am working on a website for a client and one of their requirements was to have a mailing list. I decided to XSLT to transform "templates" to HTML so that editing was very easy and less time...
1
by: EN4CER | last post by:
Let me start by apologising for my bad explanation, I know nothing about ASP :( This is the scenario: I have a Windows 2K3 SBS, 10 XP workstations, behind a router/modem/firewall. There is...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
1
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that...
2
by: thuythu | last post by:
Please help me.... I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the...
8
by: josephman1988 | last post by:
What i want to do, is have content on a homepage, which can be edited via a form on a restricted page. E.G. I have news on home page, when i go to a restricted page (e.g. mysite.co.uk/admin) i...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.