简体   繁体   中英

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="support@abc.com"
myMail.To="support@abc.com"
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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM