473,748 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cdonts

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 functionality of cdonts so that I can
test/develop on my local machine, preferably without actually sending any
mail to the persons involved.
Nov 23 '07 #1
7 2887
Paul wrote:
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 functionality of cdonts so that I can
test/develop on my local machine, preferably without actually sending any
mail to the persons involved.
Here you go: http://www.webthang.co.uk/Tuts/tuts_...p1/smtp1_1.asp

You basically download the cdonts.dll and install it on your local
machine. I have done that on my developing box and it works perfectly.

Steve
Nov 23 '07 #2

"Dooza" <st*****@SPAM.d ooza.tvwrote in message
news:Og******** ******@TK2MSFTN GP05.phx.gbl...
Paul wrote:
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 functionality of cdonts so that I can
test/develop on my local machine, preferably without actually sending any
mail to the persons involved.
Here you go: http://www.webthang.co.uk/Tuts/tuts_...p1/smtp1_1.asp

You basically download the cdonts.dll and install it on your local
machine. I have done that on my developing box and it works perfectly.

Steve

Great, just finished the install and the page now runs. I even found the
emails unsent in the Queue directory.

Paul
Nov 23 '07 #3
Great, just finished the install and the page now runs. I even found the
emails unsent in the Queue directory.
Its great when things just work :)

Steve
Nov 23 '07 #4
"Paul" <no******@btope nworld.comwrote in message
news:G6******** *************** *******@bt.com. ..
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 functionality of cdonts so that I can
test/develop on my local machine, preferably without actually sending any
mail to the persons involved.

Stop using CDONTS its deprecated. Use CDOSYS instead (CDO.Message etc).
WIth IIS5.1 CDOSYS should be already installed on an XP Pro machine.
--
Anthony Jones - MVP ASP/ASP.NET
Nov 23 '07 #5
On Nov 23, 7:00 am, "Paul" <notha...@btope nworld.comwrote :
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 functionality of cdonts so that I can
test/develop on my local machine, preferably without actually sending any
mail to the persons involved.
Thought you guys would get a kick out of some code I wrote ...

handler.asp

<%
'//
=============== =============== =============== =============== =============== =============== =============== ==============
'// This handler is only the code displayed below ... the components
this handler uses are owned by their respective owners

'// This handler allows you to use one subroutine to handle different
email components available.
'// Only one property (cp_TheComponen t) needs to be changed to switch
to using a different component.
'//
=============== =============== =============== =============== =============== =============== =============== ===============

sub cp_EmailHandler (cp_EmailArray)
dim cp_TheComponent , cp_SMTPHost, cp_From, cp_ToList, cp_ReplyTo,
cp_Subject, cp_Body, cp_Attachments
cp_TheComponent = cp_EmailArray(1 )
cp_SMTPHost = cp_EmailArray(2 )
cp_From = cp_EmailArray(3 )
cp_ToList = cp_EmailArray(4 )
cp_ReplyTo = cp_EmailArray(5 )
cp_Subject = cp_EmailArray(6 )
cp_Body = cp_EmailArray(7 )
cp_Attachments = cp_EmailArray(8 )

dim cp_MailObj, cp_n, cp_i, cp_arr1, cp_arr2, cp_str1, cp_str2,
cp_str3: cp_str1="": cp_str2="": cp_str3=""
'// SET MAIL OBJECT TO COMPONENT -- ASPEmail, CDOSys, CDONTS, or
ASPMAIL
select case cp_TheComponent
case "aspemail": Set cp_MailObj = CreateObject("P ersits.MailSend er")
case "cdosys", "cdosys_gat e": Set cp_MailObj =
CreateObject("C DO.Message")
case "cdonts": Set cp_MailObj = CreateObject("C DONTS.NewMail")
case "aspmail": Set cp_MailObj = CreateObject("S MTPsvg.Mailer")
end select
With cp_MailObj

'// ===== BEGIN - EXTRA SETTINGS FOR GATE.COM SERVICE - BEGIN =====
if cp_TheComponent = "cdosys_gat e" then
'This section provides the configuration information for the remote
SMTP server.

.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/sendusing") = 2 'Send the message using the network
(SMTP over the network).
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpserver") = "127.0.0.1"
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpserverport" ) = 25
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpusessl") = False 'Use SSL for the connection (true
or False)
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpconnectiont imeout") = 60

.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpauthenticat e") = 1 'basic (clear-text)
authentication
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/sendusername") = "de*******@cool pier.com"
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/sendpassword") = ""

.Configuration. Fields.Update
end if
'// ===== END - EXTRA SETTINGS FOR GATE.COM SERVICE - END =====

'// cp_From -- so*****@coolpie r.com,Your Name --or--
so*****@coolpie r.com
'// cp_ToList -- to,so*****@cool pier.com,Their
Name;to,an***** @coolpier.com;c c,yetan*****@co olpier.com,Name
'// -- notice the above string has
sendType,email@ address,Name(op tional)
'// -- sendType can be to, cc, or bcc *comma*
email@address *comma* Optional Name ...
'// then *semicolon* before the next one, but not one
at the end of the string
'// cp_ReplyTo -- email address only ... no name
select case cp_TheComponent
case "aspemail" '// www.persits.com
'//from
.Host = cp_SMTPHost: cp_arr1 = split(cp_From, ","): .From =
cp_arr1(0): .FromName = cp_arr1(ubound( cp_arr1))
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": .AddAddress cp_arr2(1), cp_arr2(ubound( cp_arr2))
case "cc": .AddCC cp_arr2(1), cp_arr2(ubound( cp_arr2))
case "bcc": .AddBcc cp_arr2(1), cp_arr2(ubound( cp_arr2))
end select
next
if not cp_ReplyTo = "" then .AddReplyTo cp_ReplyTo

case "cdosys", "cdosys_gat e"
'//from
cp_arr1 = split(cp_From, ","): .From = cp_arr1(ubound( cp_arr1)) & "
<" & cp_arr1(0) & ">"
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": cp_str1 = cp_str1 & ";" & cp_arr2(ubound( cp_arr2)) & "
<" & cp_arr2(1) & ">"
case "cc": cp_str2 = cp_str2 & ";" & cp_arr2(ubound( cp_arr2)) & "
<" & cp_arr2(1) & ">"
case "bcc": cp_str3 = cp_str3 & ";" & cp_arr2(ubound( cp_arr2)) &
" <" & cp_arr2(1) & ">"
end select
next
if not cp_str1 = "" then .To = replace("##" & cp_str1, "##;", "")
'// replace is removing semicolon from beginning
if not cp_str2 = "" then .Cc = replace("##" & cp_str2, "##;", "")
if not cp_str3 = "" then .Bcc = replace("##" & cp_str3, "##;", "")
if not cp_ReplyTo = "" then .ReplyTo = cp_ReplyTo
case "cdonts" '//
'//from
cp_arr1 = split(cp_From, ","): .From = cp_arr1(ubound( cp_arr1)) &
"<" & cp_arr1(0) & ">"
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": cp_str1 = cp_str1 & ";" & cp_arr2(ubound( cp_arr2)) &
"<" & cp_arr2(1) & ">"
case "cc": cp_str2 = cp_str2 & ";" & cp_arr2(ubound( cp_arr2)) &
"<" & cp_arr2(1) & ">"
case "bcc": cp_str3 = cp_str3 & ";" & cp_arr2(ubound( cp_arr2)) &
"<" & cp_arr2(1) & ">"
end select
next
if not cp_str1 = "" then .To = replace("##" & cp_str1, "##;", "")
'// replace is removing semicolon from beginning
if not cp_str2 = "" then .Cc = replace("##" & cp_str2, "##;", "")
if not cp_str3 = "" then .Bcc = replace("##" & cp_str3, "##;", "")
if not cp_ReplyTo = "" then .value("Reply-To") = cp_ReplyTo

case "aspmail" '// www.serverobjects.com
'//from
.RemoteHost = cp_SMTPHost: cp_arr1 = split(cp_From,
","): .FromAddress = cp_arr1(0): .FromName = cp_arr1(ubound( cp_arr1))
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": .AddRecipient cp_arr2(ubound( cp_arr2)), cp_arr2(1)
case "cc": .AddCC cp_arr2(ubound( cp_arr2)), cp_arr2(1)
case "bcc": .AddBCC cp_arr2(ubound( cp_arr2)), cp_arr2(1)
end select
next
if not cp_ReplyTo = "" then .ReplyTo = cp_ReplyTo

end select
'// cp_Subject -- Plain text subject line.
'// cp_Body -- HTML or plain text. if HTML, the first 6
characters must be <HTML... in caps
'// cp_Attachments -- A comma delimited string containing full path
to files to be attached
select case cp_TheComponent
case "aspemail"
.Subject = cp_Subject
.Body = cp_Body: if left(cp_Body, 6) = "<HTML>" then .IsHTML = true
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

case "cdosys", "cdosys_gat e"
.Subject = cp_Subject
.TextBody = "the body"
if left(cp_Body, 6) = "<html>" then: .HTMLBody = cp_Body:
Else: .TextBody = cp_Body: end if
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

case "cdonts"
.Subject = cp_Subject
.Body = cp_Body: if left(cp_Body, 6) = "<html>" then: .Bodyformat =
0: .Mailformat = 0: end if
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AttachFile cp_arr1(cp_n)
next
end if

case "aspmail"
.Subject = cp_Subject
.BodyText = cp_Body: if left(cp_Body, 6) = "<html>"
then .ContentType = "text/html"
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

end select
'// SEND MESSAGE
select case cp_TheComponent
case "aspemail": .Send
case "cdosys", "cdosys_gat e": .Send
case "cdonts": .Send
case "aspmail": .SendMail
end select
end with
set cp_MailObj = nothing
end sub

'// =============== ===== END COOLPIER.COM's SCRIPT
=============== =====
%>




<!-- #include virtual="/handler.asp" -->

<%
dim myEmailArray(8)
myEmailArray(1) = "cdosys" '// cp_TheComponent ()
myEmailArray(2) = "mail.yourdomai n.com" '// cp_SMTPHost ()
myEmailArray(3) = "CO**********@y ourdomain.com" '// cp_From ()
myEmailArray(4) = "to,br***@coolp ier.com" '// cp_ToList
(to,yo**@email. com)
myEmailArray(5) = "br***@coolpier .com" '// cp_ReplyTo (the reply-to
is used for webforms ... where the sender is the website, and you want
to be able to reply to the form user's email)
myEmailArray(6) = "the email subject in plain text" '// cp_Subject ()
myEmailArray(7) = "the email body .. html or plain text" '// cp_Body
(default is plain text ... to use HTML email, simply be sure that the
first 6 characters of your body are the tag ... <HTML)
myEmailArray(8) = "" '// cp_Attachments (if you wish to send an
attachment with your email, include a comma delimited string with the
full path of the files you wish to include.)

'call cp_EmailHandler (myEmailArray)
%>
Nov 24 '07 #6
On Nov 24, 4:06 am, Brynn <coolp...@gmail .comwrote:
On Nov 23, 7:00 am, "Paul" <notha...@btope nworld.comwrote :
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 functionality of cdonts so that I can
test/develop on my local machine, preferably without actually sending any
mail to the persons involved.

Thought you guys would get a kick out of some code I wrote ...

handler.asp

<%
'//
=============== =============== =============== =============== =============== =============== =============== ==============
'// This handler is only the code displayed below ... the components
this handler uses are owned by their respective owners

'// This handler allows you to use one subroutine to handle different
email components available.
'// Only one property (cp_TheComponen t) needs to be changed to switch
to using a different component.
'//
=============== =============== =============== =============== =============== =============== =============== ===============

sub cp_EmailHandler (cp_EmailArray)
dim cp_TheComponent , cp_SMTPHost, cp_From, cp_ToList, cp_ReplyTo,
cp_Subject, cp_Body, cp_Attachments
cp_TheComponent = cp_EmailArray(1 )
cp_SMTPHost = cp_EmailArray(2 )
cp_From = cp_EmailArray(3 )
cp_ToList = cp_EmailArray(4 )
cp_ReplyTo = cp_EmailArray(5 )
cp_Subject = cp_EmailArray(6 )
cp_Body = cp_EmailArray(7 )
cp_Attachments = cp_EmailArray(8 )

dim cp_MailObj, cp_n, cp_i, cp_arr1, cp_arr2, cp_str1, cp_str2,
cp_str3: cp_str1="": cp_str2="": cp_str3=""

'// SET MAIL OBJECT TO COMPONENT -- ASPEmail, CDOSys, CDONTS, or
ASPMAIL
select case cp_TheComponent
case "aspemail": Set cp_MailObj = CreateObject("P ersits.MailSend er")
case "cdosys", "cdosys_gat e": Set cp_MailObj =
CreateObject("C DO.Message")
case "cdonts": Set cp_MailObj = CreateObject("C DONTS.NewMail")
case "aspmail": Set cp_MailObj = CreateObject("S MTPsvg.Mailer")
end select
With cp_MailObj

'// ===== BEGIN - EXTRA SETTINGS FOR GATE.COM SERVICE - BEGIN =====
if cp_TheComponent = "cdosys_gat e" then
'This section provides the configuration information for the remote
SMTP server.

.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/sendusing") = 2 'Send the message using the network
(SMTP over the network).
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpserver") = "127.0.0.1"
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpserverport" ) = 25
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpusessl") = False 'Use SSL for the connection (true
or False)
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpconnectiont imeout") = 60

.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpauthenticat e") = 1 'basic (clear-text)
authentication
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/sendusername") = "develo...@cool pier.com"
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/sendpassword") = ""

.Configuration. Fields.Update
end if
'// ===== END - EXTRA SETTINGS FOR GATE.COM SERVICE - END =====

'// cp_From -- some...@coolpie r.com,Your Name --or--
some...@coolpie r.com
'// cp_ToList -- to,some...@cool pier.com,Their
Name;to,anot... @coolpier.com;c c,yetanot...@co olpier.com,Name
'// -- notice the above string has
sendType,email@ address,Name(op tional)
'// -- sendType can be to, cc, or bcc *comma*
email@address *comma* Optional Name ...
'// then *semicolon* before the next one, but not one
at the end of the string
'// cp_ReplyTo -- email address only ... no name
select case cp_TheComponent
case "aspemail" '//www.persits.com
'//from
.Host = cp_SMTPHost: cp_arr1 = split(cp_From, ","): .From =
cp_arr1(0): .FromName = cp_arr1(ubound( cp_arr1))
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": .AddAddress cp_arr2(1), cp_arr2(ubound( cp_arr2))
case "cc": .AddCC cp_arr2(1), cp_arr2(ubound( cp_arr2))
case "bcc": .AddBcc cp_arr2(1), cp_arr2(ubound( cp_arr2))
end select
next
if not cp_ReplyTo = "" then .AddReplyTo cp_ReplyTo

case "cdosys", "cdosys_gat e"
'//from
cp_arr1 = split(cp_From, ","): .From = cp_arr1(ubound( cp_arr1)) & "
<" & cp_arr1(0) & ">"
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": cp_str1 = cp_str1 & ";" & cp_arr2(ubound( cp_arr2)) & "
<" & cp_arr2(1) & ">"
case "cc": cp_str2 = cp_str2 & ";" & cp_arr2(ubound( cp_arr2)) & "
<" & cp_arr2(1) & ">"
case "bcc": cp_str3 = cp_str3 & ";" & cp_arr2(ubound( cp_arr2)) &
" <" & cp_arr2(1) & ">"
end select
next
if not cp_str1 = "" then .To = replace("##" & cp_str1, "##;", "")
'// replace is removing semicolon from beginning
if not cp_str2 = "" then .Cc = replace("##" & cp_str2, "##;", "")
if not cp_str3 = "" then .Bcc = replace("##" & cp_str3, "##;", "")
if not cp_ReplyTo = "" then .ReplyTo = cp_ReplyTo

case "cdonts" '//
'//from
cp_arr1 = split(cp_From, ","): .From = cp_arr1(ubound( cp_arr1)) &
"<" & cp_arr1(0) & ">"
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": cp_str1 = cp_str1 & ";" & cp_arr2(ubound( cp_arr2)) &
"<" & cp_arr2(1) & ">"
case "cc": cp_str2 = cp_str2 & ";" & cp_arr2(ubound( cp_arr2)) &
"<" & cp_arr2(1) & ">"
case "bcc": cp_str3 = cp_str3 & ";" & cp_arr2(ubound( cp_arr2)) &
"<" & cp_arr2(1) & ">"
end select
next
if not cp_str1 = "" then .To = replace("##" & cp_str1, "##;", "")
'// replace is removing semicolon from beginning
if not cp_str2 = "" then .Cc = replace("##" & cp_str2, "##;", "")
if not cp_str3 = "" then .Bcc = replace("##" & cp_str3, "##;", "")
if not cp_ReplyTo = "" then .value("Reply-To") = cp_ReplyTo

case "aspmail" '//www.serverobjec ts.com
'//from
.RemoteHost = cp_SMTPHost: cp_arr1 = split(cp_From,
","): .FromAddress = cp_arr1(0): .FromName = cp_arr1(ubound( cp_arr1))
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": .AddRecipient cp_arr2(ubound( cp_arr2)), cp_arr2(1)
case "cc": .AddCC cp_arr2(ubound( cp_arr2)), cp_arr2(1)
case "bcc": .AddBCC cp_arr2(ubound( cp_arr2)), cp_arr2(1)
end select
next
if not cp_ReplyTo = "" then .ReplyTo = cp_ReplyTo

end select

'// cp_Subject -- Plain text subject line.
'// cp_Body -- HTML or plain text. if HTML, the first 6
characters must be <HTML... in caps
'// cp_Attachments -- A comma delimited string containing full path
to files to be attached
select case cp_TheComponent
case "aspemail"
.Subject = cp_Subject
.Body = cp_Body: if left(cp_Body, 6) = "<HTML>" then .IsHTML = true
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

case "cdosys", "cdosys_gat e"
.Subject = cp_Subject
.TextBody = "the body"
if left(cp_Body, 6) = "<html>" then: .HTMLBody = cp_Body:
Else: .TextBody = cp_Body: end if
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

case "cdonts"
.Subject = cp_Subject
.Body = cp_Body: if left(cp_Body, 6) = "<html>" then: .Bodyformat =
0: .Mailformat = 0: end if
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AttachFile cp_arr1(cp_n)
next
end if

case "aspmail"
.Subject = cp_Subject
.BodyText = cp_Body: if left(cp_Body, 6) = "<html>"
then .ContentType = "text/html"
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

end select

'// SEND MESSAGE
select case cp_TheComponent
case "aspemail": .Send
case "cdosys", "cdosys_gat e": .Send
case "cdonts": .Send
case "aspmail": .SendMail
end select

end with
set cp_MailObj = nothing
end sub

'// =============== ===== END COOLPIER.COM's SCRIPT
=============== =====
%>

<!-- #include virtual="/handler.asp" -->

<%
dim myEmailArray(8)
myEmailArray(1) = "cdosys" '// cp_TheComponent ()
myEmailArray(2) = "mail.yourdomai n.com" '// cp_SMTPHost ()
myEmailArray(3) = "CONTACT_T...@y ourdomain.com" '// cp_From ()
myEmailArray(4) = "to,br...@coolp ier.com" '// cp_ToList
(to,y...@email. com)
myEmailArray(5) = "br...@coolpier .com" '// cp_ReplyTo (the reply-to
is used for webforms ... where the sender is the website, and you want
to be able to reply to the form user's email)
myEmailArray(6) = "the email subject in plain text" '// cp_Subject ()
myEmailArray(7) = "the email body .. html or plain text" '// cp_Body
(default is plain text ... to use HTML email, simply be sure that the
first 6 characters of your body are the tag ... <HTML)
myEmailArray(8) = "" '// cp_Attachments (if you wish to send an
attachment with your email, include a comma delimited string with the
full path of the files you wish to include.)

'call cp_EmailHandler (myEmailArray)
%





BLAH!!!!! Dam new news reader program ... screwed up the formatting of
that code!!!! Sorry guys.

My apologies ... here is a link ... I placed a webpage up with the
code if anyone wants it.

http://www.brynncurry.com/brynn/_gro...er/default.asp

This actually will handle cdonts, cdosys, aspemail, and aspmail ... I
wrote it way back when ... and still give it to friends of mine that
use shared hosting and what have you that like to use aspmail or jump
around between them.
Nov 24 '07 #7
Thanks - I squirrel away such Handlers
Pete(Northolt UK)

Brynn wrote:
On Nov 24, 4:06 am, Brynn <coolp...@gmail .comwrote:
On Nov 23, 7:00 am, "Paul" <notha...@btope nworld.comwrote :
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 functionality of cdonts so that I can
test/develop on my local machine, preferably without actually sending any
mail to the persons involved.
Thought you guys would get a kick out of some code I wrote ...

handler.asp

<%
'//
=============== =============== =============== =============== =============== =============== =============== ==============
'// This handler is only the code displayed below ... the components
this handler uses are owned by their respective owners

'// This handler allows you to use one subroutine to handle different
email components available.
'// Only one property (cp_TheComponen t) needs to be changed to switch
to using a different component.
'//
=============== =============== =============== =============== =============== =============== =============== ===============

sub cp_EmailHandler (cp_EmailArray)
dim cp_TheComponent , cp_SMTPHost, cp_From, cp_ToList, cp_ReplyTo,
cp_Subject, cp_Body, cp_Attachments
cp_TheComponent = cp_EmailArray(1 )
cp_SMTPHost = cp_EmailArray(2 )
cp_From = cp_EmailArray(3 )
cp_ToList = cp_EmailArray(4 )
cp_ReplyTo = cp_EmailArray(5 )
cp_Subject = cp_EmailArray(6 )
cp_Body = cp_EmailArray(7 )
cp_Attachments = cp_EmailArray(8 )

dim cp_MailObj, cp_n, cp_i, cp_arr1, cp_arr2, cp_str1, cp_str2,
cp_str3: cp_str1="": cp_str2="": cp_str3=""

'// SET MAIL OBJECT TO COMPONENT -- ASPEmail, CDOSys, CDONTS, or
ASPMAIL
select case cp_TheComponent
case "aspemail": Set cp_MailObj = CreateObject("P ersits.MailSend er")
case "cdosys", "cdosys_gat e": Set cp_MailObj =
CreateObject("C DO.Message")
case "cdonts": Set cp_MailObj = CreateObject("C DONTS.NewMail")
case "aspmail": Set cp_MailObj = CreateObject("S MTPsvg.Mailer")
end select
With cp_MailObj

'// ===== BEGIN - EXTRA SETTINGS FOR GATE.COM SERVICE - BEGIN =====
if cp_TheComponent = "cdosys_gat e" then
'This section provides the configuration information for the remote
SMTP server.

.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/sendusing") = 2 'Send the message using the network
(SMTP over the network).
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpserver") = "127.0.0.1"
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpserverport" ) = 25
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpusessl") = False 'Use SSL for the connection (true
or False)
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpconnectiont imeout") = 60

.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/smtpauthenticat e") = 1 'basic (clear-text)
authentication
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/sendusername") = "develo...@cool pier.com"
.Configuration. Fields.Item ("http://schemas.microso ft.com/cdo/
configuration/sendpassword") = ""

.Configuration. Fields.Update
end if
'// ===== END - EXTRA SETTINGS FOR GATE.COM SERVICE - END =====

'// cp_From -- some...@coolpie r.com,Your Name --or--
some...@coolpie r.com
'// cp_ToList -- to,some...@cool pier.com,Their
Name;to,anot... @coolpier.com;c c,yetanot...@co olpier.com,Name
'// -- notice the above string has
sendType,email@ address,Name(op tional)
'// -- sendType can be to, cc, or bcc *comma*
email@address *comma* Optional Name ...
'// then *semicolon* before the next one, but not one
at the end of the string
'// cp_ReplyTo -- email address only ... no name
select case cp_TheComponent
case "aspemail" '//www.persits.com
'//from
.Host = cp_SMTPHost: cp_arr1 = split(cp_From, ","): .From =
cp_arr1(0): .FromName = cp_arr1(ubound( cp_arr1))
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": .AddAddress cp_arr2(1), cp_arr2(ubound( cp_arr2))
case "cc": .AddCC cp_arr2(1), cp_arr2(ubound( cp_arr2))
case "bcc": .AddBcc cp_arr2(1), cp_arr2(ubound( cp_arr2))
end select
next
if not cp_ReplyTo = "" then .AddReplyTo cp_ReplyTo

case "cdosys", "cdosys_gat e"
'//from
cp_arr1 = split(cp_From, ","): .From = cp_arr1(ubound( cp_arr1)) & "
<" & cp_arr1(0) & ">"
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": cp_str1 = cp_str1 & ";" & cp_arr2(ubound( cp_arr2)) & "
<" & cp_arr2(1) & ">"
case "cc": cp_str2 = cp_str2 & ";" & cp_arr2(ubound( cp_arr2)) & "
<" & cp_arr2(1) & ">"
case "bcc": cp_str3 = cp_str3 & ";" & cp_arr2(ubound( cp_arr2)) &
" <" & cp_arr2(1) & ">"
end select
next
if not cp_str1 = "" then .To = replace("##" & cp_str1, "##;", "")
'// replace is removing semicolon from beginning
if not cp_str2 = "" then .Cc = replace("##" & cp_str2, "##;", "")
if not cp_str3 = "" then .Bcc = replace("##" & cp_str3, "##;", "")
if not cp_ReplyTo = "" then .ReplyTo = cp_ReplyTo

case "cdonts" '//
'//from
cp_arr1 = split(cp_From, ","): .From = cp_arr1(ubound( cp_arr1)) &
"<" & cp_arr1(0) & ">"
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": cp_str1 = cp_str1 & ";" & cp_arr2(ubound( cp_arr2)) &
"<" & cp_arr2(1) & ">"
case "cc": cp_str2 = cp_str2 & ";" & cp_arr2(ubound( cp_arr2)) &
"<" & cp_arr2(1) & ">"
case "bcc": cp_str3 = cp_str3 & ";" & cp_arr2(ubound( cp_arr2)) &
"<" & cp_arr2(1) & ">"
end select
next
if not cp_str1 = "" then .To = replace("##" & cp_str1, "##;", "")
'// replace is removing semicolon from beginning
if not cp_str2 = "" then .Cc = replace("##" & cp_str2, "##;", "")
if not cp_str3 = "" then .Bcc = replace("##" & cp_str3, "##;", "")
if not cp_ReplyTo = "" then .value("Reply-To") = cp_ReplyTo

case "aspmail" '//www.serverobjec ts.com
'//from
.RemoteHost = cp_SMTPHost: cp_arr1 = split(cp_From,
","): .FromAddress = cp_arr1(0): .FromName = cp_arr1(ubound( cp_arr1))
'//to
cp_arr1 = split(cp_ToList , ";")
for cp_n = 0 to ubound(cp_arr1)
cp_arr2 = split(cp_arr1(c p_n), ",")
select case cp_arr2(0)
case "to": .AddRecipient cp_arr2(ubound( cp_arr2)), cp_arr2(1)
case "cc": .AddCC cp_arr2(ubound( cp_arr2)), cp_arr2(1)
case "bcc": .AddBCC cp_arr2(ubound( cp_arr2)), cp_arr2(1)
end select
next
if not cp_ReplyTo = "" then .ReplyTo = cp_ReplyTo

end select

'// cp_Subject -- Plain text subject line.
'// cp_Body -- HTML or plain text. if HTML, the first 6
characters must be <HTML... in caps
'// cp_Attachments -- A comma delimited string containing full path
to files to be attached
select case cp_TheComponent
case "aspemail"
.Subject = cp_Subject
.Body = cp_Body: if left(cp_Body, 6) = "<HTML>" then .IsHTML = true
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

case "cdosys", "cdosys_gat e"
.Subject = cp_Subject
.TextBody = "the body"
if left(cp_Body, 6) = "<html>" then: .HTMLBody = cp_Body:
Else: .TextBody = cp_Body: end if
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

case "cdonts"
.Subject = cp_Subject
.Body = cp_Body: if left(cp_Body, 6) = "<html>" then: .Bodyformat =
0: .Mailformat = 0: end if
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AttachFile cp_arr1(cp_n)
next
end if

case "aspmail"
.Subject = cp_Subject
.BodyText = cp_Body: if left(cp_Body, 6) = "<html>"
then .ContentType = "text/html"
if not cp_Attachments = "" then
cp_arr1 = split(cp_Attach ments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

end select

'// SEND MESSAGE
select case cp_TheComponent
case "aspemail": .Send
case "cdosys", "cdosys_gat e": .Send
case "cdonts": .Send
case "aspmail": .SendMail
end select

end with
set cp_MailObj = nothing
end sub

'// =============== ===== END COOLPIER.COM's SCRIPT
=============== =====
%>

<!-- #include virtual="/handler.asp" -->

<%
dim myEmailArray(8)
myEmailArray(1) = "cdosys" '// cp_TheComponent ()
myEmailArray(2) = "mail.yourdomai n.com" '// cp_SMTPHost ()
myEmailArray(3) = "CONTACT_T...@y ourdomain.com" '// cp_From ()
myEmailArray(4) = "to,br...@coolp ier.com" '// cp_ToList
(to,y...@email. com)
myEmailArray(5) = "br...@coolpier .com" '// cp_ReplyTo (the reply-to
is used for webforms ... where the sender is the website, and you want
to be able to reply to the form user's email)
myEmailArray(6) = "the email subject in plain text" '// cp_Subject ()
myEmailArray(7) = "the email body .. html or plain text" '// cp_Body
(default is plain text ... to use HTML email, simply be sure that the
first 6 characters of your body are the tag ... <HTML)
myEmailArray(8) = "" '// cp_Attachments (if you wish to send an
attachment with your email, include a comma delimited string with the
full path of the files you wish to include.)

'call cp_EmailHandler (myEmailArray)
%

BLAH!!!!! Dam new news reader program ... screwed up the formatting of
that code!!!! Sorry guys.

My apologies ... here is a link ... I placed a webpage up with the
code if anyone wants it.

http://www.brynncurry.com/brynn/_gro...er/default.asp

This actually will handle cdonts, cdosys, aspemail, and aspmail ... I
wrote it way back when ... and still give it to friends of mine that
use shared hosting and what have you that like to use aspmail or jump
around between them.
Nov 25 '07 #8

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

Similar topics

1
4705
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 the site in which CDONTS to one of the IIS "sites" which is known to work with CDONTS, and still, no email received. The bad mail dir gets three files each time, the error is:
29
3541
by: | last post by:
I did a working code with CDONTS on NT4 Now I am testing is on w2k and it looks like objCDONTS.Send is completely ignored. I think is it ignored because it throws no errors, neither does the rest of the code setting objCDONTS=Server.CreateObject("CDONTS.NewMail") and then manipulating its properties. Do I need to somehow set IIS5 to make objCDONTS.Send work?
7
2546
by: Mario Leduc | last post by:
Hi, I have a page that sends user comments with CDONTS, works fine. Until I put a URL (http://192.168.0.1). If I use http://domain.com it works fine. Why with the numeric URL, CDONTS does not send the mail?? Thanks
8
3952
by: Boris | last post by:
Could someone please tell me if I can use CDONTS in W 2003 Server environment to send emails the same way it is used in W2K Server. I have heard that CDONTS is no longer available in W 2003 Server and if so, how can I send emails from ASP page... Many thanks in advance
4
4335
by: F | last post by:
Hi Some one has posted this question on 10th August, as CDONTS is not working on windows 2003 serever. I have the same problem and I copied CDONTS.DLL from Windows 2000 Server and registered on Win 2003 server but it giving the error on line when I calling method send of the object. Error is Microsoft VBScript runtime error '800a0046'
16
3170
by: tshad | last post by:
I have both cdosys.dll and cdonts.dll on my W2K3 server. We have been told by our web authors that their asp code won't work on our machine and that we don't have CDONTS installed on our machine. They're getting an error from: Set objCDOMail = Server.CreateObject("CDONTS.NewMail") I know that the new format is:
9
6275
by: scott | last post by:
I have my win 2003 server setup correct with SMTP. I know because I've tested it ok. However, when I issue CODE 1 below, I get ERROR 1 below. I thought having SMTP installed correctly allowed ASP to use CDONTS as a mail generator. Is there more to it? CODE 1: Set objMail = Server.CreateObject("CDONTS.NewMail")
2
9385
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 on how to do this using CDO. Unfortunately, I don't have that option. I must use C# and CDonts. Do you have any ideas or code? In traditional ASP, the code was: objMail = Server.CreateObject("CDONTS.NewMail"); objMail.To =...
5
27703
by: MichaelK | last post by:
What do I need to do to enable CDONTS om my macine to make it working I'm testing the code: Dim objCDO Set objCDO = Server.CreateObject("CDONTS.NewMail") objCDO.To = "xyz@xxxxx.com" objCDO.From = "zyx@zzzzz.com" objCDO.Subject = "TESST CDONTS MAIL" objCDO.Body = "SOME TEXT TO SEND OVER"
0
8979
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8818
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9307
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9225
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8234
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6790
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3296
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 we have to send another system
2
2773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.