greener
greener

Reputation: 5069

Sending email in ASP (CDO message) hangs about 5 to 10 secs each time

I'm sending an email using this code:

Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sign-up"
myMail.From="[email protected]"
myMail.To="[email protected]"
myMail.HTMLBody = signup
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.1and1.com"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing

and while this is executed, the page hangs. It takes about 5 to 10 seconds before it moves on. Apologies if this is trivial but do I need a separate queuing mechanism because I don't this on other websites. How are they doing this?

Upvotes: 4

Views: 2633

Answers (1)

Andrew Cowenhoven
Andrew Cowenhoven

Reputation: 2816

Does the mail get sent? You say it takes a few seconds before it moves on - what do you mean?

I looked at some of my asp cdo code that I have kicking around and I think you have to instantiate a CDO.Configuration object. Perhaps have a function that sets the config values for you, something like:

Function GetConfig()
Dim oConfig
Set oConfig = CreateObject("CDO.Configuration")
oConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    'etc...
     oConfig.Fields.Update
     Set GetConfig = oConfig
End Function

Upvotes: 1

Related Questions