RON DE BRUIN: Help with CDO Please

N

Newbike

Hi Ron -
First let me say THANK YOU for being such a great resource! You and
your website have helped me out a great deal.

I started using the CDO emails to send status and reports at certain
intervals every morning while my computer runs a battery of daily
reports. Below is an example of one of these emails, the only
difference with each mailer is the body text, attachments and the
recipient list.

Sub SndInv()
Set oEmail = CreateObject("CDO.Message")
oEmail.From = myserver
oEmail.To = myrecipients
oEmail.Subject = "AUTOMATED MAILER: "
oEmail.Textbody = "* * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *" & vbNewLine _
& vbNewLine _
& "Attached is the Report for " & Format(Date, "m/d/
yy") & vbNewLine _
& "* * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * *"
oEmail.AddAttachment "path/file name"
oEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/
configuration/sendusing") = 2
oEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/
configuration/smtpserver") = "my mail server"
oEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/
configuration/authenticate") = 1
oEmail.Configuration.Fields.Update
oEmail.Send
Set oEmail = Nothing
End Sub

This code works ALMOST flawlessly. However from time to time I
"cannot connect to transport server". There is no pattern to this
whatsoever. Today, 4 out of 6 emails have not been sent (the other
two have not run yet as of this posting), prior to today there have
been no issues for over a month.

Given how sporodical the errors are, i don't think it is a firewall
issue...but not sure....

Any insight? Do you have any ideas as to how I could write an error
handler (never written one) that could save the emails (to send
manually?) and let the reports keep running instead of waiting for a
debug?


Any help would be much appreciated!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top