473,473 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

CDONTS !! Dynamic Data in email

I am trying to generate an email from the webpage using code below, which
works fine. However I want to be able to include some dyanmic data how do I
go about it ?can anybody point me in the direction of some sample code ?

Thanks Dave
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<%

Dim myMail
Dim HTML
Set myMail = CreateObject("CDONTS.NewMail")

HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & "content=""text/html; charset=iso-8859-1"">"
HTML = HTML & "<meta name=""GENERATOR"""
HTML = HTML & " content=""Microsoft Visual Studio 6.0"">"
HTML = HTML & "<title>HTMLMail</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""FFFFFF"">"
HTML = HTML & "<IMG SRC=""http://www.microsoft.com/library/"
HTML = HTML & "images/gifs/homepage/microsoft.gif"" BORDER=0 "
HTML = HTML & "WIDTH=167 HEIGHT=36 ALT=""Microsoft Corporation"">"
HTML = HTML & "<p><font size =""3"" face=""Arial""><strong>"
HTML = HTML & "Microsoft Exchange CDONTS Example</strong></p>"
HTML = HTML & "<p><font size =""2"" face=""Tahoma"">"
HTML = HTML & "CDO for NTS allows an easy way to send mail.<br>"
HTML = HTML & "This example shows how the content can be "
HTML = HTML & "an HTML page<br>"
HTML = HTML & "which allows you to send rich text and"
HTML = HTML & "inline graphics.</p>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"

myMail.From="so*****@microsoft.com"
myMail.To="so*****@microsoft.com"
myMail.Subject="Sample CDONTS HTML Message"
myMail.BodyFormat=0
myMail.MailFormat=0
myMail.Body=HTML
myMail.Send
set mymail=nothing
Response.Write "Message Sent"
%>
</HEAD>
<BODY>
</BODY>
</HTML>
Jul 19 '05 #1
6 1614

"dave" <da**@griffineng.co.uk> wrote in message
news:ci**********@sparta.btinternet.com...
I am trying to generate an email from the webpage using code below, which
works fine. However I want to be able to include some dyanmic data how do I go about it ?can anybody point me in the direction of some sample code ?


Dynamic how?

Ray at home
Jul 19 '05 #2
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:u2*************@TK2MSFTNGP14.phx.gbl...

"dave" <da**@griffineng.co.uk> wrote in message
news:ci**********@sparta.btinternet.com...
I am trying to generate an email from the webpage using code below, which works fine. However I want to be able to include some dyanmic data how
do I
go about it ?can anybody point me in the direction of some sample code ?


Dynamic how?

Ray at home

Dyanmic in the sense of I want to be able to pull data from sql and display
it in a formatted html table which in turn is embeded in an email message,
basically like when you buy something online and you have a confirmation
email showing what you ordered, that is what I want to be able to do. I may
be going completly the wrong way about it due to my ignorance any help is
gratefully received

Dave
Jul 19 '05 #3
Do you know how to build a web-page that would display this data? If so,
it's the same basic idea, except that instead of writing the html to a
browser, you save it to a variable that will become the .HTMLBody of your
CDO.Message object (assuming that's what you use).

So, forget the e-mailing for a moment, and focus on just creating a web page
with the data you want. Can you do that?

Ray at work

"Dave" <da**@griffineng.co.uk> wrote in message
news:KA*****************@newsfe6-gui.ntli.net...

Dyanmic in the sense of I want to be able to pull data from sql and
display
it in a formatted html table which in turn is embeded in an email message,
basically like when you buy something online and you have a confirmation
email showing what you ordered, that is what I want to be able to do. I
may
be going completly the wrong way about it due to my ignorance any help is
gratefully received

Dave

Jul 19 '05 #4
Thanks Ray,

I can build an asp page that shows the data I require to be sent in the
email , Just about ! :-)

What do I do next ?

Dave

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:e2**************@TK2MSFTNGP11.phx.gbl...
Do you know how to build a web-page that would display this data? If so,
it's the same basic idea, except that instead of writing the html to a
browser, you save it to a variable that will become the .HTMLBody of your
CDO.Message object (assuming that's what you use).

So, forget the e-mailing for a moment, and focus on just creating a web page with the data you want. Can you do that?

Ray at work

"Dave" <da**@griffineng.co.uk> wrote in message
news:KA*****************@newsfe6-gui.ntli.net...

Dyanmic in the sense of I want to be able to pull data from sql and
display
it in a formatted html table which in turn is embeded in an email message, basically like when you buy something online and you have a confirmation
email showing what you ordered, that is what I want to be able to do. I
may
be going completly the wrong way about it due to my ignorance any help is gratefully received

Dave


Jul 19 '05 #5

Well, let's say that this is your page that returns data:

page.asp:
<html><head><title>something</title></head>
<body>
<%
UserID = 6
Dim oADO, oRS
Set oADO = CreateObject("ADODB.Connection")
Set oRS = oADO.Execute("SELECT COUNT(transID) FROM Trans WHERE UserID=" &
UserID)
%>
You have placed <%=oRS.Fields.Item(0).Value%> orders.
<%
oRS.Close : Set oRS = Nothing
oADO.Close : Set oADO = Nothing
</body>
</html>

To turn that into an e-mail, you'd dump all the html to a variable, i.e.

<%
sBody = "<html><head><title>something</title></head>" & vbCrLf
sBody = sBody & "<body>" & vbCrLf
UserID = 6
Dim oADO, oRS
Set oADO = CreateObject("ADODB.Connection")
Set oRS = oADO.Execute("SELECT COUNT(transID) FROM Trans WHERE UserID=" &
UserID)
sBody = sBody & "You have placed " & oRS.Fields.Item(0).Value & " orders." &
vbCrLf
oRS.Close : Set oRS = Nothing
oADO.Close : Set oADO = Nothing
sBody = sBody & "</body>" & vbCrLf
sBody = sBody & "</html>"

Set oCDO = CreateObject("CDO.Message")
oCDO.From = "sd*@kjasdf.cmdf"
oCDO.To = "kj******@kjasdf.omc"
oCDO.Subject = "orders"
oCDO.HtmlBody = sBody
oCDO.Send
%>

Does that make sense?

Ray at work


"Dave" <da**@griffineng.co.uk> wrote in message
news:0p*****************@newsfe6-gui.ntli.net...
Thanks Ray,

I can build an asp page that shows the data I require to be sent in the
email , Just about ! :-)

What do I do next ?

Dave

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:e2**************@TK2MSFTNGP11.phx.gbl...
Do you know how to build a web-page that would display this data? If so,
it's the same basic idea, except that instead of writing the html to a
browser, you save it to a variable that will become the .HTMLBody of your
CDO.Message object (assuming that's what you use).

So, forget the e-mailing for a moment, and focus on just creating a web

page
with the data you want. Can you do that?

Ray at work

"Dave" <da**@griffineng.co.uk> wrote in message
news:KA*****************@newsfe6-gui.ntli.net...
>>
> Dyanmic in the sense of I want to be able to pull data from sql and
> display
> it in a formatted html table which in turn is embeded in an email message, > basically like when you buy something online and you have a
> confirmation
> email showing what you ordered, that is what I want to be able to do. I
> may
> be going completly the wrong way about it due to my ignorance any help is > gratefully received
>
> Dave
>
>



Jul 19 '05 #6
brilliant thankyou
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:e$**************@TK2MSFTNGP09.phx.gbl...

Well, let's say that this is your page that returns data:

page.asp:
<html><head><title>something</title></head>
<body>
<%
UserID = 6
Dim oADO, oRS
Set oADO = CreateObject("ADODB.Connection")
Set oRS = oADO.Execute("SELECT COUNT(transID) FROM Trans WHERE UserID=" &
UserID)
%>
You have placed <%=oRS.Fields.Item(0).Value%> orders.
<%
oRS.Close : Set oRS = Nothing
oADO.Close : Set oADO = Nothing
</body>
</html>

To turn that into an e-mail, you'd dump all the html to a variable, i.e.

<%
sBody = "<html><head><title>something</title></head>" & vbCrLf
sBody = sBody & "<body>" & vbCrLf
UserID = 6
Dim oADO, oRS
Set oADO = CreateObject("ADODB.Connection")
Set oRS = oADO.Execute("SELECT COUNT(transID) FROM Trans WHERE UserID=" &
UserID)
sBody = sBody & "You have placed " & oRS.Fields.Item(0).Value & " orders."
& vbCrLf
oRS.Close : Set oRS = Nothing
oADO.Close : Set oADO = Nothing
sBody = sBody & "</body>" & vbCrLf
sBody = sBody & "</html>"

Set oCDO = CreateObject("CDO.Message")
oCDO.From = "sd*@kjasdf.cmdf"
oCDO.To = "kj******@kjasdf.omc"
oCDO.Subject = "orders"
oCDO.HtmlBody = sBody
oCDO.Send
%>

Does that make sense?

Ray at work


"Dave" <da**@griffineng.co.uk> wrote in message
news:0p*****************@newsfe6-gui.ntli.net...
Thanks Ray,

I can build an asp page that shows the data I require to be sent in the
email , Just about ! :-)

What do I do next ?

Dave

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:e2**************@TK2MSFTNGP11.phx.gbl...
Do you know how to build a web-page that would display this data? If
so,
it's the same basic idea, except that instead of writing the html to a
browser, you save it to a variable that will become the .HTMLBody of
your
CDO.Message object (assuming that's what you use).

So, forget the e-mailing for a moment, and focus on just creating a web

page
with the data you want. Can you do that?

Ray at work

"Dave" <da**@griffineng.co.uk> wrote in message
news:KA*****************@newsfe6-gui.ntli.net...
>>
> Dyanmic in the sense of I want to be able to pull data from sql and
> display
> it in a formatted html table which in turn is embeded in an email

message,
> basically like when you buy something online and you have a
> confirmation
> email showing what you ordered, that is what I want to be able to do.
> I
> may
> be going completly the wrong way about it due to my ignorance any help

is
> gratefully received
>
> Dave
>
>



Jul 19 '05 #7

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

Similar topics

1
by: | last post by:
Hi Guys CDONTS works with all sites hosted on my test server bar one (which surely rules out a miscomputation of the Default SMTP server in IIS). I have tried uploading the file with make up...
1
by: Lars | last post by:
Hi I don't know if this is the right forum but I need some help and advise. I want to create a form where I can enclose files from local disc and mail with CDONTS. I want to use a form...
5
by: BaWork | last post by:
I have a web form where a client can select which site members to send an email to. This form is populated from the contents of the member table, so the form can have 0-x names listed on it...
7
by: Griff | last post by:
I have been using the CDONTS component on Windows 2000 to send emails for a long time now (code below). However, over time, the report that I am sending has got rather longer and it now gives me...
2
by: microsoft.public.dotnet.languages.csharp | last post by:
ASP.Net, C#, Email message, CDonts not CDO I am writing an ASP.Net application where I cannot use CDO. I must use CDonts. I cannot find an example of this on the Internet. I only see examples...
1
by: Stimp | last post by:
I'm trying to send a mail using CDONTS with a .FROM email address that doesn't exist (like bob@nowhere.com), but it won't send the mail unless I put a valid .FROM email address (i.e. of an email...
4
by: Dr. Harvey Waxman | last post by:
I guess I should change from cdonts to cdosys. Since I am ignorant about asp I hope you forgive this basic question. There are two asp files for handling mail, the one that gets the info from a...
7
by: Paul | last post by:
I have just started work on a system using CDONTS to mail out. Whilst this is fine on the server, my local development machine is using XP Pro with IIS5.1 installed. Is there a way I can get the...
6
by: jbguernsey | last post by:
for: There was no reference to CDO in the References so selected CDO. Code didn't work (CDONTS.email unrecognised). read There was no reference to CDONTS in the References so selected CDO....
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.