473,412 Members | 3,471 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,412 software developers and data experts.

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 2861
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.dooza.tvwrote in message
news:Og**************@TK2MSFTNGP05.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******@btopenworld.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...@btopenworld.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_TheComponent) 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("Persits.MailSender")
case "cdosys", "cdosys_gate": Set cp_MailObj =
CreateObject("CDO.Message")
case "cdonts": Set cp_MailObj = CreateObject("CDONTS.NewMail")
case "aspmail": Set cp_MailObj = CreateObject("SMTPsvg.Mailer")
end select
With cp_MailObj

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

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

.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/smtpauthenticate") = 1 'basic (clear-text)
authentication
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/sendusername") = "de*******@coolpier.com"
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/sendpassword") = ""

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

'// cp_From -- so*****@coolpier.com,Your Name --or--
so*****@coolpier.com
'// cp_ToList -- to,so*****@coolpier.com,Their
Name;to,an*****@coolpier.com;cc,yetan*****@coolpie r.com,Name
'// -- notice the above string has
sendType,email@address,Name(optional)
'// -- 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(cp_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_gate"
'//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(cp_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(cp_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(cp_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_Attachments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

case "cdosys", "cdosys_gate"
.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_Attachments, ",")
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_Attachments, ",")
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_Attachments, ",")
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_gate": .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.yourdomain.com" '// cp_SMTPHost ()
myEmailArray(3) = "CO**********@yourdomain.com" '// cp_From ()
myEmailArray(4) = "to,br***@coolpier.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...@btopenworld.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_TheComponent) 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("Persits.MailSender")
case "cdosys", "cdosys_gate": Set cp_MailObj =
CreateObject("CDO.Message")
case "cdonts": Set cp_MailObj = CreateObject("CDONTS.NewMail")
case "aspmail": Set cp_MailObj = CreateObject("SMTPsvg.Mailer")
end select
With cp_MailObj

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

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

.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/smtpauthenticate") = 1 'basic (clear-text)
authentication
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/sendusername") = "develo...@coolpier.com"
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/sendpassword") = ""

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

'// cp_From -- some...@coolpier.com,Your Name --or--
some...@coolpier.com
'// cp_ToList -- to,some...@coolpier.com,Their
Name;to,anot...@coolpier.com;cc,yetanot...@coolpie r.com,Name
'// -- notice the above string has
sendType,email@address,Name(optional)
'// -- 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(cp_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_gate"
'//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(cp_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(cp_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(cp_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_Attachments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

case "cdosys", "cdosys_gate"
.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_Attachments, ",")
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_Attachments, ",")
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_Attachments, ",")
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_gate": .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.yourdomain.com" '// cp_SMTPHost ()
myEmailArray(3) = "CONTACT_T...@yourdomain.com" '// cp_From ()
myEmailArray(4) = "to,br...@coolpier.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...@btopenworld.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_TheComponent) 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("Persits.MailSender")
case "cdosys", "cdosys_gate": Set cp_MailObj =
CreateObject("CDO.Message")
case "cdonts": Set cp_MailObj = CreateObject("CDONTS.NewMail")
case "aspmail": Set cp_MailObj = CreateObject("SMTPsvg.Mailer")
end select
With cp_MailObj

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

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

.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/smtpauthenticate") = 1 'basic (clear-text)
authentication
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/sendusername") = "develo...@coolpier.com"
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/sendpassword") = ""

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

'// cp_From -- some...@coolpier.com,Your Name --or--
some...@coolpier.com
'// cp_ToList -- to,some...@coolpier.com,Their
Name;to,anot...@coolpier.com;cc,yetanot...@coolpie r.com,Name
'// -- notice the above string has
sendType,email@address,Name(optional)
'// -- 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(cp_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_gate"
'//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(cp_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(cp_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(cp_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_Attachments, ",")
for cp_n = 0 to ubound(cp_arr1)
.AddAttachment cp_arr1(cp_n)
next
end if

case "cdosys", "cdosys_gate"
.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_Attachments, ",")
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_Attachments, ",")
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_Attachments, ",")
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_gate": .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.yourdomain.com" '// cp_SMTPHost ()
myEmailArray(3) = "CONTACT_T...@yourdomain.com" '// cp_From ()
myEmailArray(4) = "to,br...@coolpier.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
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...
29
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...
7
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...
8
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...
4
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...
16
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....
9
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...
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...
5
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"...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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...

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.