ASU Web Community

HELP! What's wrong with my CDO.Message?

Monday, March 3rd, 2008 - 2:30 pm
  • kipper
  • kipper's picture

This is the code I was given. It's frequently timing out (about half of all transactions), which makes users go back and resubmit their forms. We don't want that. What can I do to make this not time out? Thank you.

'-- CDO E-mail Processing --

Const cdoSendUsingMethod        = "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSMTPServer             = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort         = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout  = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate       = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic                  = 1
Const cdoSendUserName           = "http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword           = "http://schemas.microsoft.com/cdo/configuration/sendpassword"


Dim objConfig  ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields     ' As ADODB.Fields

Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

' Set config fields we care about

With Fields
     .Item(cdoSendUsingMethod)       = 2
     .Item(cdoSMTPServer)            = "smtp.asu.edu"
     .Item(cdoSMTPServerPort)        = 25
     .Item(cdoSMTPConnectionTimeout) = 30
    '.Item(cdoSendUsername) = "<enter_username_here>" 
    '.Item(cdoSendPassword) = "<enter_password_here>" 
     .Item(cdoSMTPAuthenticate)      = 0
     .Update
End With

Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig

With objMessage
.To = "swh@asu.edu"
             .From     = "Web Registration <asuf.web@asu.edu>"
if attending="yes" then
.Subject = "W&P RSVP - YES - " & firstname & " " & lastname
else
.Subject = "W&P RSVP - NO - " & firstname & " " & lastname
end if
     .TextBody = emailBody
     .Send

End With

Set objMessage = Nothing
Set objConfig = Nothing

Tuesday, March 11th, 2008 - 11:09 am
  • cscholtz
  • cscholtz's picture

Hi not sure off hand but try this script.  It uses a few less constants than yours.  If still timing out then could be an issue on your IIS.  What version are you running?

Dim newMail ' An instance of CDO message.
Set newMail = Server.CreateObject("CDO.Message")
newMail.From = "SomeEmailAddress@asu.edu" ' Use your ASU email to see this work.
newMail.To = "SomeEmailAddress@asu.edu" ' Use your ASU email to see this work.
'newMail.Cc = "SomeEmailAddress@asu.edu"
'newMail.Bcc = "SomeEmailAddress@asu.edu"
newMail.Subject = "Sample E-mail using CDOSYS"
Dim messageBody ' String holds body of message.
messageBody  = "Here is the sample message you created." & vBCrLf & vBCrLf & _
"Message Sent: " & Now()
newMail.TextBody = messageBody
' Include an attachment. Be sure to include file extension in the name.
'newMail.AddAttachment "c:\path\FileName"
' Set Importance. 0 = Low, 1 = Normal, 2 = High.
newMail.Fields("urn:schemas:httpmail:importance").Value = 2
newMail.Fields.Update()
newMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "asmtp.asu.edu"
newMail.Send()
Set newMail = Nothing
 

cheers,

Cameron

Friday, March 14th, 2008 - 1:47 pm
  • kipper
  • kipper's picture

Thanks, Cameron -- this seems to be working great!

Sunday, October 18th, 2009 - 4:00 am
  • dyemez

Thank you for dizi izle problem