469,962 Members | 2,815 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,962 developers. It's quick & easy.

ASP / CDOSYS - Performance issue

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%", "em****@myserver.com"
pde.add "%webmaster%", "em****@myserver.com"
pde.add "%info%", "em****@myserver.com"
pde.add "%email%", "em****@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") =
"em****@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)?

Jun 27 '08 #1
8 3092
what happend if you set set another smtp server for delivery ?
perhaps the ip, or ns of the smtp have changed ?...

hth
ks

"worldofrugs" <u43325@uweescribiĆ³ en el mensaje news:838264834bf90@uwe...
| 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%", "em****@myserver.com"
| pde.add "%webmaster%", "em****@myserver.com"
| pde.add "%info%", "em****@myserver.com"
| pde.add "%email%", "em****@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") =
| "em****@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)?
|

Jun 27 '08 #2
Thanks Keyser,
But nope.. I have checked all settings and even tried a few alternatives..
Same result i'm afraid..
Still have this huge delay, that I don't seem to understand..

keyser soze wrote:
>what happend if you set set another smtp server for delivery ?
perhaps the ip, or ns of the smtp have changed ?...

hth
ks

| 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..
[quoted text clipped - 160 lines]
| how to change this to CDO instead of CDOSYS (as this worked for the shopping
| cart)?
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200805/1

Jun 27 '08 #3
Thanks Keyser,
But nope.. I have checked all settings and even tried a few alternatives..
Same result i'm afraid..
Still have this huge delay, that I don't seem to understand..

keyser soze wrote:
>what happend if you set set another smtp server for delivery ?
perhaps the ip, or ns of the smtp have changed ?...

hth
ks

| 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..
[quoted text clipped - 160 lines]
| how to change this to CDO instead of CDOSYS (as this worked for the shopping
| cart)?
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200805/1

Jun 27 '08 #4
worldofrugs wrote on Thu, 01 May 2008 17:37:19 GMT:
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...
What do the message headers in delayed emails look like, and how do they
compare to ones that aren't delayed? It's entirely possible that godaddy's
own servers are delaying the sending of messages due the headers, treating
some of them at a lower priority than others due to missing or extraneous
headers compared to the other ones.

--
Dan
Jun 27 '08 #5
Comments inline.

worldofrugs wrote on Tue, 06 May 2008 16:09:14 GMT:
Not delayed message (send via our shopping cart, using CDO)
--------
Received: from unknown (68.178.211.76)
by smtpout06-04.prod.mesa1.secureserver.net (64.202.165.227) with
ESMTP; 28
Apr 2008 18:21:14 -0000 thread-index: AcipXKSP9r2CI8iHTq67P7m+A0KPWQ==
Here's the first received line - notice how it appears to go direct to the
mail server smtpout06-04.prod.mesa1.secureserver.net.

Delayed message (using html form with the script using CDOSYS)
--------
Received: from unknown (HELO WINHOSTECN76.hosting.corp.gd)
([68.178.211.76])
(envelope-sender <xx**@gmail.com>)
by smtpout16-02.prod.mesa1.secureserver.net (qmail-ldap-1.03)
with
SMTP for <my****@myserver.com>; 2 May 2008 01:47:28 -0000
Received: from mail pickup service by WINHOSTECN76.hosting.corp.gd with
Microsoft SMTPSVC;
Wed, 30 Apr 2008 16:39:44 -0700
Is the delay around 2 hours? Notice that the first received line here is
from the mail pickup service at 23:39 UTC, but the next line shows it being
passed at 01:47 UTC to the next server inline. Assuming that the times shown
are correct, here's your delay.
These are 2 headers from a delayed message and a non-delayed message..
Delayed used CDOSYS + the mentioned script and the NOT delayed message
came from our shopping cart, using CDO
Is there any difference in the SMTP host names being used? Such as the CDO
one in the cart specifying a host (using the smtpserver property), but the
CDOSYS one not (in which case it is written to a local queue file for MS
SMTP server first where it hangs around in the hard disk queue for a while
before being passed to the outgoing server). That's all I can think of,
unfortunately I don't use CDO or CDOSYS, I prefer to use ASPEmail as it
gives me a lot more control over the messaging.

--
Dan
Jun 27 '08 #6
I just noticed something else from your original post that I missed first
time around. You wrote that you tried these too:

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") =
"em****@myserver.com"
msg.Configuration.Fields.Item ("
http://schemas.microsoft.com/cdo/configuration/sendpassword") = "abc1234"
Did you also remember to include after this, before sending, the following:

msg.Configuration.Fields.Update
If not, those settings would not have been used - which would cause CDO to
dump the message to the local queue folder where it would wait for the SMTP
service to pick it up and process it to send it out. If there is a massive
amount of locally queued mail this could explain the 2 hours delay.

--
Dan
Jun 27 '08 #7
Daniel, U THE MAN!!!
I think it might be indeed the "msg.Configuration.Fields.Update" line i was
forgetting...
Adding (enabling) the following lines, got rid of all the delays!

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") = 25
msg.Configuration.Fields.Item("
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =1
msg.Configuration.Fields.Item("
http://schemas.microsoft.com/cdo/configuration/sendusername") =
"my****@myserver.com"
msg.Configuration.Fields.Item("
http://schemas.microsoft.com/cdo/configuration/sendpassword") = "abc1234"
msg.Configuration.Fields.Item("
http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
msg.Configuration.Fields.Update

Thank you SOOOO MUCH Daniel! I have been stuck on this so long already.

Daniel Crichton wrote:
>I just noticed something else from your original post that I missed first
time around. You wrote that you tried these too:

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") =
"em****@myserver.com"
msg.Configuration.Fields.Item ("
http://schemas.microsoft.com/cdo/configuration/sendpassword") = "abc1234"

Did you also remember to include after this, before sending, the following:

msg.Configuration.Fields.Update

If not, those settings would not have been used - which would cause CDO to
dump the message to the local queue folder where it would wait for the SMTP
service to pick it up and process it to send it out. If there is a massive
amount of locally queued mail this could explain the 2 hours delay.

--
Dan
--
Message posted via http://www.webmasterkb.com

Jun 27 '08 #8
worldofrugs wrote on Wed, 07 May 2008 14:20:05 GMT:
Daniel, U THE MAN!!!
I think it might be indeed the "msg.Configuration.Fields.Update" line i
was forgetting...
Adding (enabling) the following lines, got rid of all the delays!
Thank you SOOOO MUCH Daniel! I have been stuck on this so long already.
Glad to have been able to help. I've learnt a bit more about CDO now, and
I'm just hoping that if I ever have to use it that I remember to include
that line :P

--
Dan
Jun 27 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

21 posts views Thread by tp | last post: by
14 posts views Thread by Neil Ginsberg | last post: by
8 posts views Thread by Akbur | last post: by
4 posts views Thread by =?Utf-8?B?SmVycnkgQw==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.