I have the following code:
Set myMailanon = CreateObject("CDO.Message")
myMailanon.MimeFormatted = True
Set myConfanon = Server.CreateObject("CDO.Configuration")
Set objBPanon = myMailanon.AddRelatedBodyPart("http://www.foo.bar/img/logo1.jpg", "http://www.foo.bar/img/logo1.jpg", CdoReferenceTypeName)
objBPanon.Fields.Item("urn:schemas:mailheader:Content-ID") = "<http://www.foo.bar/img/logo1.jpg>"
objBPanon.Fields.Update
ConfURLanon = "http://schemas.microsoft.com/cdo/configuration/"
with myConfanon
.Fields.Item(ConfURLanon & "sendusing") = 2
.Fields.Item(ConfURLanon & "smtpserver") = "smtp.foo.bar"
.Fields.Item(ConfURLanon & "smtpserverport") = 25
.Fields.Item(ConfURLanon & "smtpusessl") = false
.Fields.Item(ConfURLanon & "smtpauthenticate") = 1
.Fields.Item(ConfURLanon & "sendusername") = "foo@bar.com"
.Fields.Item(ConfURLanon & "sendpassword") = "foobarpass"
.Fields.Update
end with
with myMailanon
.Subject='Foo!! Bar!!'
.From='Foo!! Bar!! <foo@bar.com>'
.To='foo@bar.com,bar@foo.com'
txt="This is foo... bar... text... SPARTAAAAAAAAA"
.HTMLBody = txt
Set .Configuration = myConfanon
On Error Resume Next
.Send
end with
Problem is that this code, run 100 times, will work 30 and fail 70. Randomly. And by "fail" I mean that it will cause Script execution timeout.
After commenting line by line, I got to the conclusion that the error comes from ".Send". But why? Any ideas?
Regards