navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

ASP / CDOSYS - Performance issue

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> ASP / CDOSYS - Performance issue
Page: [1]
 
worldofrugs

 

Posts: 2
Joined: 5/1/2008
Status: offline

 
ASP / CDOSYS - Performance issue - 5/1/2008 12:13:38   
I'm hosted on a shared server with Godaddy.com... I have several forms on my website that all use the same ASP file to send out my forms..
It worked fine for a long time, but now the forms send to my e-mail arrive after a few hours instead of instantly.
Calling Godaddy did not help as they stated all is working fine (no delays) on their end and refuse to help with custom scripts..

My emails are also hosted by godaddy like my website.

Hopefully someone here can have a look at my code and see why I might have such huge delays?
Note:
The delays seem to happen when using CDOSYS... I'm also setting up a shopping cart (ProductCart) and when using the CDOSYS function for their email script it has also a huge delay, while setting it to CDO it arrives within minutes...
I do not get any errors, all seems to go fine and mail does arrive after a few hours.

Here's the code (personal info marked out of cos):
 <%
option explicit
dim pde : set pde = createobject("scripting.dictionary")

pde.add "%mailing%", "email1@myserver.com"
pde.add "%webmaster%", "email2@myserver.com"
pde.add "%info%", "email3@myserver.com"
pde.add "%email%", "email4@myserver.com"

function getTextFromFile(path)
dim fso, f, txt
set fso = createobject("Scripting.FileSystemObject")
if not fso.fileexists(path) then
getTextFromFile = ""
exit function
end if
set f = fso.opentextfile(path,1)
if f.atendofstream then txt = "" else txt = f.readall
f.close
set f = nothing
set fso = nothing
getTextFromFile = txt
end function

dim redir, mailto, email, subject, item, body, cc, bcc, message, html, template, usetemplate, testmode
redir = request.form("redirect")
mailto = request.form("mailto")
if pde.exists(mailto) then mailto = pde(mailto)
cc = request.form("cc")
bcc = request.form("bcc")
email = request.form("email")
if email = "" then email = pde("%email%")
subject = request.form("subject")
message = request.form("message")
template = request.form("template")
testmode = lcase(request.form("testmode"))="no"

if len(template) > 0 then template = getTextFromFile(server.mappath(template))
if len(template) > 0 then usetemplate = true else usetemplate = false
dim msg : set msg = server.createobject("CDO.Message")
msg.subject = subject
msg.to = mailto
msg.from = email
if len(cc) > 0 then msg.cc = cc
if len(bcc) > 0 then msg.bcc = bcc

if not usetemplate then
body = body & message & vbcrlf & vbcrlf
else
body = template
end if
for each item in request.form
select case item
case "redirect", "mailto", "cc", "bcc", "subject", "message", "template", "html", "testmode"
case else
if not usetemplate then
if item <> "email" then body = body & item & ": " & request.form(item) & vbcrlf & vbcrlf
else
body = replace(body, "[$" & item & "$]", replace(request.form(item),vbcrlf,"<br>"))
end if
end select
next

if usetemplate then 'remove any leftover placeholders
dim rx : set rx = new regexp
rx.pattern = "\[\$.*\$\]"
rx.global = true
body = rx.replace(body, "")
end if

if usetemplate and lcase(request.form("html")) = "yes" then
msg.htmlbody = body
else
msg.textbody = body
end if
if testmode then
if lcase(request.form("html")) = "yes" then
response.write "<pre>" & vbcrlf
response.write "Mail to: " & mailto & vbcrlf
response.write "Mail from: " & email & vbcrlf
if len(cc) > 0 then response.write "Cc: " & cc & vbcrlf
if len(bcc) > 0 then response.write "Bcc: " & bcc & vbcrlf
response.write "Subject: " & subject & vbcrlf & string(80,"-") & "</pre>"
response.write body
else
response.write "<html><head><title>Sendmail.asp Test Mode</title></head><body><pre>" & vbcrlf
response.write "Mail to: " & mailto & vbcrlf
response.write "Mail from: " & email & vbcrlf
if len(cc) > 0 then response.write "Cc: " & cc & vbcrlf
if len(bcc) > 0 then response.write "Bcc: " & bcc & vbcrlf
response.write "Subject: " & subject & vbcrlf & vbcrlf
response.write string(80,"-") & vbcrlf & vbcrlf & "<span style=""color:blue;"">"
response.write body & "</span>" & vbcrlf & vbcrlf
response.write string(80,"-") & vbcrlf & "**END OF EMAIL**</pre></body></html>"
end if
else
msg.send
response.redirect redir
end if
set msg = nothing
%>


I also tried adding these lines (and combinations) without any better results:

msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "relay-hosting.secureserver.net"
msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 3535
msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =1
msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "email1@myserver.com"
msg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "abc1234"


Here's a sample of what's used in the forms:
 <form action="/sendmail_cdo.asp" method="post" name="SampleForm" id="SampleForm">
<input type="hidden" name="redirect" value="http://www.myserver.com/thanks.htm">
<input name="mailto" type="hidden" id="mailto" value="%webmaster%">
<input name="subject" type="hidden" id="subject" value="Website Form Submission: Sample form from website">


In the html template used with the form, I use [$form_fieldname$] to display the values entered in the forms.


Anyone any ideas why there might be this huge delay and/or does anyone know how to change this to CDO instead of CDOSYS (as this worked for the shopping cart)?
rdouglass

 

Posts: 9137
From: Biddeford, ME USA
Status: offline

 
RE: ASP / CDOSYS - Performance issue - 5/1/2008 12:18:38   
Hi and Welcome to OutFront.

Do both methods use the same method to send the emails? For instance, are you sending your CDO using one relay server and CDOSYS for another? If they are both sending via SMTP to the same account and service there shouldn't be any difference. (But you knew that already...:))

Is this just for 1 individual form or is it part of a mass mailing? I'm guessing 1 form but just double checking.

Hope that helps.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to worldofrugs)
worldofrugs

 

Posts: 2
Joined: 5/1/2008
Status: offline

 
RE: ASP / CDOSYS - Performance issue - 5/1/2008 12:27:23   
yeah they both use the same relay server, etc...
This script is used on all my forms on my website...
It is working, but as mentioned: there's a huge delay in submitting the form and receiving the message..

(in reply to rdouglass)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> ASP / CDOSYS - Performance issue
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts