Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_cdo thread: Newbie question on CDO 2000


Message #1 by "Diane Schips" <info@M...> on Mon, 2 Jul 2001 12:40:20 -0400
OK, I'm completely flummoxed.  I have Wrox's ASP 3.0 for professionals book,

which was the only book I could find that even mentioned CDO for Windows

2000 as more than a "coming soon to a computer near you...".  It's a good

book, but it still leaves me with many questions.  I've been to Microsoft's

site, but the documentation I found only helped a little.

I want to send email containing both HTML and Text messages, and I don't

necessarily want the text to be built from the HTML.  I'll generally want to

build it myself.  I'm using ASP and vbscript.  I'll be sending out the email

to a membership list of about 350 members.  Can someone help me with an

example?

I would also very much appreciate the following:

	A link for a "CDO 2000 for Dummies" type of explanation to help me get

started - so that I can understand enough to be able to better follow the

more complete but overwhelming explanations I've found so far.

	A link to a list of the options and settings available for CDO 2000

I keep going over the same stuff again and again, but I'm just not getting

it.

Thanks,

Diane



Message #2 by "Siegfried Weber" <sweber@c...> on Mon, 2 Jul 2001 22:26:42 +0200
I neither have a link to get you started (except those which point to

MSDN <g>) nor a good book recommendation which really covers CDOSYS (aka

CDO for Windows 2000). Maybe the Exchange SDK (formerly referred as WSS

SDK) might be helpful. It has a fair amount of CDOSYS stuff which should

get you started.



However, here's a little code snippet that should do the trick:



<!--METADATA TYPE=3D"typelib" 

UUID=3D"CD000000-8B95-11D1-82DB-00C04FB1625D"

NAME=3D"CDO for Windows 2000 Library" -->



<%

Set objConfiguration =3D CreateObject("CDO.Configuration")

Set objFields =3D objConfiguration.Fields

With objFields

	.Item(cdoSendUsingMethod) =3D cdoSendUsingPort

	.Item(cdoSMTPServerPort) =3D 25

	.Item(cdoSMTPServer) =3D "YourMailServer.YourDomain.Com"

	.Update

End With

Set objMessage =3D CreateObject("CDO.Message")

With objMessage

	Set .Configuration =3D objConfiguration

	.From =3D "YourOriginator@Y..."

	.To =3D "TheRecipient@T..."

	.Subject =3D "Here comes a Subject"

	.HTMLBody =3D "<html><body> Here is an HTML body! </body></htm>"

	.AutoGenerateTextBody =3D False

	.TextBody =3D "Here is a text body"

	.Send

End With

%>



<Siegfried/>



> -----Original Message-----

> From: Diane Schips [mailto:info@M...]

> Sent: Monday, July 02, 2001 6:40 PM

> To: ASP CDO

> Subject: [asp_cdo] Newbie question on CDO 2000

>

> OK, I'm completely flummoxed.  I have Wrox's ASP 3.0 for professionals

> book,

> which was the only book I could find that even mentioned CDO for

Windows

> 2000 as more than a "coming soon to a computer near you...".  It's a

good

> book, but it still leaves me with many questions.  I've been to

> Microsoft's

> site, but the documentation I found only helped a little.

> I want to send email containing both HTML and Text messages, and I

don't

> necessarily want the text to be built from the HTML.  I'll generally

want

> to

> build it myself.  I'm using ASP and vbscript.  I'll be sending out the

> email

> to a membership list of about 350 members.  Can someone help me with

an

> example?

> I would also very much appreciate the following:

> 	A link for a "CDO 2000 for Dummies" type of explanation to help

me

> get

> started - so that I can understand enough to be able to better follow

the

> more complete but overwhelming explanations I've found so far.

> 	A link to a list of the options and settings available for CDO

2000

> I keep going over the same stuff again and again, but I'm just not

getting

> it.

> Thanks,

> Diane

>

>

Message #3 by "Diane Schips" <info@M...> on Mon, 2 Jul 2001 17:22:12 -0400
Thank you, Thank you, Thank you!  This does what I want it to do.



I intend to use the code you suggested, but maybe you can explain something

for me.  I was originally playing with the .CreateMHTMLBody

http://www.TBSofS.org/newsletter.htm option.  If I sent it to my Outlook

client, I received the HTML output without a problem, and after adding the

.TextBody = "something" line, I received the text portion in my text only

email client just fine, thank you..  But when I went to look at the email

online (using WebMail) prior to downloading it to Outlook, I got garbage.

It looks like this:



y?>AwTtc e%>> < L O Pf "aw h / t e h d : =fw =fw "f>i=iB eT0e%> Bi Odg i e t

/ >>m./> pY a tON r t d :< 8 C>>m. l " t t / 1cw / lc 0m ihn a raae y y yd

>U=m n r h.eg aNTlte tt a Modts < hrm4TF =c fc lp.G=Cunni asSa aonnenwe m g

triHsf ewoS: is lyur. Rtt/>nt tta c u se/ps/kesw s t0aA7n/t/s >/oe"n"/ cA0

rt >lF8y u o a u"Rdi b 0 > Odg< >ao i R B c >=< 8 p/ '>i n B g p fP > w t d

fdB DT< hT rd m mD< g flT d h>

Yet, again, after I download it to Outlook, it looks fine.  It's a complete

newsletter, so I'm surprised that the above only takes three lines.  Am I

doing something wrong or incomplete with the CreateMHTMLBody option?

Diane



Message #4 by "Diane Schips" <info@M...> on Mon, 2 Jul 2001 17:26:22 -0400
Siegfried:



I have another question, this one regarding performance.  I want to send out

my email to about 350 people.  Should I reuse the object, changing the strTo

information, or should I create, use and close the object for each email I'm

sending?



Thanks again,

Diane







Message #5 by "Siegfried Weber" <sweber@c...> on Tue, 3 Jul 2001 09:04:21 +0200
.CreateMHTMLBody creates a MIME formatted HTML message with embedded

images which your web-based mailreader probably don't understand.



What web-based mailsystem is it? I've used several and all did

understand my stuff created with .CreateMHTMLBody.



If you want to try it out yourself go to:



http://212.18.22.93/mskb/sendmskb.asp?article=3DQ123456



and play with it. It uses .CreateMHTMLBody to return Microsoft Knowledge

Base article by e-mail derived from they Website.



<Siegfried/>



> -----Original Message-----

> From: Diane Schips [mailto:info@M...]

> Sent: Monday, July 02, 2001 11:22 PM

> To: ASP CDO

> Subject: [asp_cdo] RE: Newbie question on CDO 2000

>

> Thank you, Thank you, Thank you!  This does what I want it to do.

>

> I intend to use the code you suggested, but maybe you can explain

> something

> for me.  I was originally playing with the .CreateMHTMLBody

> http://www.TBSofS.org/newsletter.htm option.  If I sent it to my

Outlook

> client, I received the HTML output without a problem, and after adding

the

> .TextBody =3D "something" line, I received the text portion in my text

only

> email client just fine, thank you..  But when I went to look at the

email

> online (using WebMail) prior to downloading it to Outlook, I got

garbage.

> It looks like this:

>

> y?>AwTtc e%>> < L O Pf "aw h / t e h d : =3Dfw =3Dfw "f>i=3DiB eT0e%> 

Bi Odg

i e

> t

> / >>m./> pY a tON r t d :< 8 C>>m. l " t t / 1cw / lc 0m ihn a raae y

y yd

> >U=3Dm n r h.eg aNTlte tt a Modts < hrm4TF =3Dc fc lp.G=3DCunni asSa

aonnenwe m

> g

> triHsf ewoS: is lyur. Rtt/>nt tta c u se/ps/kesw s t0aA7n/t/s >/oe"n"/

cA0

> rt >lF8y u o a u"Rdi b 0 > Odg< >ao i R B c >=3D< 8 p/ '>i n B g p fP 

>

w t

> d

> fdB DT< hT rd m mD< g flT d h>

> Yet, again, after I download it to Outlook, it looks fine.  It's a

> complete

> newsletter, so I'm surprised that the above only takes three lines.

Am I

> doing something wrong or incomplete with the CreateMHTMLBody option?

> Diane



Message #6 by Eli Schilling <eschilli@t...> on Mon, 2 Jul 2001 15:21:11 -0700
What about bcc'ing everyone?



strTo = "so&so@h..."

strTo = strTo & "so&so@t..."

strTo = strTo & "me@h..."

etc....



objNewMail.bcc = strTo



Then you could add and remove people relatively easily.



-Eli



-----Original Message-----

From: Diane Schips [mailto:info@M...]

Sent: Monday, July 02, 2001 2:26 PM

To: ASP CDO

Subject: [asp_cdo] RE: Newbie question on CDO 2000





Siegfried:



I have another question, this one regarding performance.  I want to send out

my email to about 350 people.  Should I reuse the object, changing the strTo

information, or should I create, use and close the object for each email I'm

sending?



Thanks again,

Diane



Message #7 by "Siegfried Weber" <sweber@c...> on Tue, 3 Jul 2001 09:07:30 +0200
I'd go with a reuse of the CDO.Configuration & CDO.Message object and

just stuff in new parameters for the recipient (haven't played with it

yet but have to soon <g>).



And I'd make sure running Windows 2000 SP2 because it fixes a bunch of

SMTP related stuff.



<Siegfried/>



> -----Original Message-----

> From: Diane Schips [mailto:info@M...]

> Sent: Monday, July 02, 2001 11:26 PM

> To: ASP CDO

> Subject: [asp_cdo] RE: Newbie question on CDO 2000

>

> Siegfried:

>

> I have another question, this one regarding performance.  I want to

send

> out

> my email to about 350 people.  Should I reuse the object, changing the

> strTo

> information, or should I create, use and close the object for each

email

> I'm

> sending?

>

> Thanks again,

> Diane





Message #8 by "Diane Schips" <info@M...> on Tue, 3 Jul 2001 07:20:08 -0400
Aside from having about 350 email addresses, I would like each member to

receive a professional looking email.  Bcc'ing everyone doesn't look right.

It's fine for an email notifying committee members of the next meeting, but

not for the Temple newsletters.



Diane



-----Original Message-----

From: Eli Schilling [mailto:eschilli@t...]

Sent: Monday, July 02, 2001 6:21 PM

To: ASP CDO

Subject: [asp_cdo] RE: Newbie question on CDO 2000



What about bcc'ing everyone?



strTo = "so&so@h..."

strTo = strTo & "so&so@t..."

strTo = strTo & "me@h..."

etc....



objNewMail.bcc = strTo



Then you could add and remove people relatively easily.



-Eli



-----Original Message-----

From: Diane Schips [mailto:info@M...]

Sent: Monday, July 02, 2001 2:26 PM

To: ASP CDO

Subject: [asp_cdo] RE: Newbie question on CDO 2000





Siegfried:



I have another question, this one regarding performance.  I want to send out

my email to about 350 people.  Should I reuse the object, changing the strTo

information, or should I create, use and close the object for each email I'm

sending?



Thanks again,

Diane







Message #9 by "Siegfried Weber" <sweber@c...> on Tue, 3 Jul 2001 13:41:06 +0200
I totally agree with you. That's the reason why I'm right now developing

a newsletter subscription system which relies on Windows 2000/Exchange

2000 and doesn't use Bcc but separate emails for each subscriber.



To bad that this app will not become a freebee <vbg>.



<Siegfried/>



> -----Original Message-----

> From: Diane Schips [mailto:info@M...]

> Sent: Tuesday, July 03, 2001 1:20 PM

> To: ASP CDO

> Subject: [asp_cdo] RE: Newbie question on CDO 2000

>

> Aside from having about 350 email addresses, I would like each member

to

> receive a professional looking email.  Bcc'ing everyone doesn't look

> right.

> It's fine for an email notifying committee members of the next

meeting,

> but

> not for the Temple newsletters.

>

> Diane

>

Message #10 by "Diane Schips" <info@M...> on Tue, 3 Jul 2001 07:59:36 -0400
The web based mailsystem is Imail.  I tried the link, and aside from 6

syntax error alerts regarding line 1, it worked fine.  I could see the page.

If I send the HTML content explicitly, using the .HTMLBody="HTML stuff", it

comes through fine.  But if I use the .CreateMHTMLBody, I get the message OK

after downloading it to Outlook, but I can't see it properly in iMail.



I think I'm using it right.  The code is simple:



.<%

.strFrom="""Diane Schips"" <webmaster@T...>"

.strTo="""Diane Schips"" <test@T...>"

.strSubject = "MHTML Test Message"



.Set objMsg = Server.CreateObject("CDO.Message")



.With objMsg

.   .To       = strTo

.   .From     = strFrom

.   .Subject  = strSubject

.   .CreateMHTMLBody "http://www.TBSofS.org/newsletter2.htm"

.End With



.objMsg.Send



.Set objMsg = Nothing

.%>



Am I doing something wrong?



Diane



-----Original Message-----

From: Siegfried Weber [mailto:sweber@c...]

Sent: Tuesday, July 03, 2001 3:04 AM

To: ASP CDO

Subject: [asp_cdo] RE: Newbie question on CDO 2000



.CreateMHTMLBody creates a MIME formatted HTML message with embedded

images which your web-based mailreader probably don't understand.



What web-based mailsystem is it? I've used several and all did

understand my stuff created with .CreateMHTMLBody.



If you want to try it out yourself go to:



http://212.18.22.93/mskb/sendmskb.asp?article=Q123456



and play with it. It uses .CreateMHTMLBody to return Microsoft Knowledge

Base article by e-mail derived from they Website.



<Siegfried/>





Message #11 by Pappas Nikos <pappas@c...> on Tue, 03 Jul 2001 15:23:24 +0300
Hi there

Excuse a newbie's opinion



Is there anything wrong if someone takes the email adresses from a database 

and create a loop for each record?



create the recordset

while not eof bof etc



dim FromEmail

dim ToEmail

FromEmail="mysite whatever"

ToEmail=put the value of the record here



  Dim objMail

  Set objMail = Server.CreateObject("CDONTS.NewMail")

     objMail.From ="" & FromEmail

     objMail.Subject = "Confirmation mail"

     objMail.To = "" & ToEmail

     objMail.Body = "new entry"

     objMail.Send

  set objMail = nothing



loop this 



Looks like it is going to work if you can make sure you have all email adresse wright 

so you wont have any errors



At 01:41 μμ 3/7/2001 +0200, you wrote:

>I totally agree with you. That's the reason why I'm right now developing

>a newsletter subscription system which relies on Windows 2000/Exchange

>2000 and doesn't use Bcc but separate emails for each subscriber.

>

>To bad that this app will not become a freebee <vbg>.

>

><Siegfried/>

>

>> -----Original Message-----

>> From: Diane Schips [mailto:info@M...]

>> Sent: Tuesday, July 03, 2001 1:20 PM

>> To: ASP CDO

>> Subject: [asp_cdo] RE: Newbie question on CDO 2000

>> 

>> Aside from having about 350 email addresses, I would like each member

>to

>> receive a professional looking email.  Bcc'ing everyone doesn't look

>> right.

>> It's fine for an email notifying committee members of the next

>meeting,

>> but

>> not for the Temple newsletters.

>> 

>> Diane

>>

>



Message #12 by "Siegfried Weber" <sweber@c...> on Tue, 3 Jul 2001 14:42:50 +0200
Hmmm. I don't get any errors when I load the page.



Anyways, as I mentioned in one of my previous messages. .CreateMHTMLBody

creates a MIME formatted HTML message with embedded images which your

web-based mailreader probably don't understand. But if you use .HTMLBody

it will be a plain "text/html" message which even IMail seems to be able

to understand.



Looks like you need to open the HTML file and stream the content into

.HTMLBody. Check the FileSystemObject to see how to open a file and read

it's contents.



<Siegfried/>



> -----Original Message-----

> From: Diane Schips [mailto:info@M...]

> Sent: Tuesday, July 03, 2001 2:00 PM

> To: ASP CDO

> Subject: [asp_cdo] RE: Newbie question on CDO 2000

>

> The web based mailsystem is Imail.  I tried the link, and aside from 6

> syntax error alerts regarding line 1, it worked fine.  I could see the

> page.

> If I send the HTML content explicitly, using the .HTMLBody=3D"HTML

stuff",

> it

> comes through fine.  But if I use the .CreateMHTMLBody, I get the

message

> OK

> after downloading it to Outlook, but I can't see it properly in iMail.

>

> I think I'm using it right.  The code is simple:

>

> .<%

> .strFrom=3D"""Diane Schips"" <webmaster@T...>"

> .strTo=3D"""Diane Schips"" <test@T...>"

> .strSubject =3D "MHTML Test Message"

>

> .Set objMsg =3D Server.CreateObject("CDO.Message")

>

> .With objMsg

> .   .To       =3D strTo

> .   .From     =3D strFrom

> .   .Subject  =3D strSubject

> .   .CreateMHTMLBody "http://www.TBSofS.org/newsletter2.htm"

> .End With

>

> .objMsg.Send

>

> .Set objMsg =3D Nothing

> .%>

>

> Am I doing something wrong?

>

> Diane

>

Message #13 by "Diane Schips" <info@M...> on Tue, 3 Jul 2001 08:41:23 -0400
There's nothing wrong with this at all.  In fact, this is the way it's

generally done.  Beats entering in the email addresses each time you send

out email!



The best way to tell if something like this will work is to try it.  You can

even use the same email address in multiple records, just to see if the

email is being sent out OK.  Then if you get any errors, or run into

problems, let us know and we'll try to help you.



Diane



-----Original Message-----

From: Pappas Nikos [mailto:pappas@c...]

Sent: Tuesday, July 03, 2001 8:23 AM

To: ASP CDO

Subject: [asp_cdo] RE: Newbie question on CDO 2000



Hi there

Excuse a newbie's opinion



Is there anything wrong if someone takes the email adresses from a database

and create a loop for each record?



create the recordset

while not eof bof etc



dim FromEmail

dim ToEmail

FromEmail="mysite whatever"

ToEmail=put the value of the record here



  Dim objMail

  Set objMail = Server.CreateObject("CDONTS.NewMail")

     objMail.From ="" & FromEmail

     objMail.Subject = "Confirmation mail"

     objMail.To = "" & ToEmail

     objMail.Body = "new entry"

     objMail.Send

  set objMail = nothing



loop this



Looks like it is going to work if you can make sure you have all email

adresse wright

so you wont have any errors







Message #14 by "Siegfried Weber" <sweber@c...> on Tue, 3 Jul 2001 14:44:16 +0200
No, there is nothing wrong with this method beside of the fact that I

don't use CDONTS but CDOSYS you could do it that way.



I still prefer the (IMHO faster) solution by just reusing the

CDO.Message & CDO.Configuration objects for performance reasons.



<Siegfried/>



> -----Original Message-----

> From: Pappas Nikos [mailto:pappas@c...]

> Sent: Tuesday, July 03, 2001 2:23 PM

> To: ASP CDO

> Subject: [asp_cdo] RE: Newbie question on CDO 2000

>

> Hi there

> Excuse a newbie's opinion

>

> Is there anything wrong if someone takes the email adresses from a

> database

> and create a loop for each record?

>

> create the recordset

> while not eof bof etc

>

> dim FromEmail

> dim ToEmail

> FromEmail=3D"mysite whatever"

> ToEmail=3Dput the value of the record here

>

>   Dim objMail

>   Set objMail =3D Server.CreateObject("CDONTS.NewMail")

>      objMail.From =3D"" & FromEmail

>      objMail.Subject =3D "Confirmation mail"

>      objMail.To =3D "" & ToEmail

>      objMail.Body =3D "new entry"

>      objMail.Send

>   set objMail =3D nothing

>

> loop this

>

> Looks like it is going to work if you can make sure you have all email

> adresse wright

> so you wont have any errors

>





Message #15 by "Diane Schips" <info@M...> on Tue, 3 Jul 2001 09:35:42 -0400
Actually Siegfried, I'm building the HTMLBody and TextBody from a database.

I'm not sure that CreateMHTMLBody does anything for me.  The system I'm

putting together is rather complex, using templates to allow users to enter

the information for their own newsletters into the database from which the

HTML and Text emails are generated.  There are times when I will want the

email contents to differ slightly depending on which format is used.  A

perfect example is the ads I intend to include.  I'll use banner ads for the

HTML format, and different, text ads for the Text format.  Ads?  Did I say

Ads?  Yeah (hanging head) I did.  I signed up the temple to various

affiliate programs.  The ads will be pulled from them.  If our membership

were to make online purchases through our affiliates, it would help our

fundraising efforts.



The problem is that I don't expect this to be my only foray into this area,

and I may need to use CreateMHTMLBody at some point.  I'm concerned that the

link you gave me before generated an email than iMail can read (embedded

images and all), but I can't.  I'd feel much better if I knew why.



Anyway, thanks for all your help.  I know enough to move forward with this

project, except that I have the same problem as mariamr@g...  Email

sent to any msn.com email address gets bounced back as undeliverable (they

are valid addresses).  My next step is to ask msn.com about it.  Unless

someone on this list knows why?



Thanks again

Diane



-----Original Message-----

From: Siegfried Weber [mailto:sweber@c...]

Sent: Tuesday, July 03, 2001 8:43 AM

To: ASP CDO

Subject: [asp_cdo] RE: Newbie question on CDO 2000



Hmmm. I don't get any errors when I load the page.



Anyways, as I mentioned in one of my previous messages. .CreateMHTMLBody

creates a MIME formatted HTML message with embedded images which your

web-based mailreader probably don't understand. But if you use .HTMLBody

it will be a plain "text/html" message which even IMail seems to be able

to understand.



Looks like you need to open the HTML file and stream the content into

.HTMLBody. Check the FileSystemObject to see how to open a file and read

it's contents.



<Siegfried/>






  Return to Index