Using the CDO object to send email...

B

Brad Pears

I am using the CDO object to send email automatically from an Access 2000
application. It has been working flawlessly until just recently, when users
have been experiencing a "transport unavailable" message.

After doing some debugging, I discovered that the strSch variable which I
set to "http://schemas.microsoft.com/cdo/configuration" is unavailable if
you attempt to go to this location using your web browser...

I can get as far as schemas.microsoft.com and that is it....

I am not sure that this is the issue but I believe that this site must be
available in order for the CDO object to work. Can someone confirm if this
has been a recent problem and what the new site might be if it has moved?

Thanks

Brad


PS... Here is a sample of the code which uses the CDO object to send email
which I said earlier has been working flawlessly for almost a year...

--------------------------------------------------------------------------------------------------------------

Public Sub SendEmail(strTo As String, strSubject As String, strBody As
String)
On Error GoTo Error_Handler
Const cdoSendUsingPort = 2
Const cdoBasic = 1
Dim objCDOConfig As Object, objCDOMessage As Object
Dim strSch As String

strSch = "http://schemas.microsoft.com/cdo/configuration/"
Set objCDOConfig = CreateObject("CDO.Configuration")

With objCDOConfig.Fields
.Item(strSch & "sendusing") = cdoSendUsingPort
.Item(strSch & "smtpserver") = "true3"
'Only used if SMTP server requires Authentication
.Item(strSch & "smtpauthenticate") = cdoBasic
.Item(strSch & "sendusername") = "user"
.Item(strSch & "sendpassword") = "password"
.Update
End With

Set objCDOMessage = CreateObject("CDO.Message")

With objCDOMessage
Set .Configuration = objCDOConfig
.From = getEmailAddress(CurrentUser())
.Sender = getEmailAddress(CurrentUser())
.To = strTo
.Subject = strSubject
.TextBody = strBody
'.HTMLBody = "This is not Bold But <B>This is!</B>"
.Send
End With

' Exit and cleanup
MsgBox "Email successfully sent to " & strTo

Exit_Here:
Set objCDOMessage = Nothing
Set objCDOConfig = Nothing

Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub
 
R

Ron Weiner

Brad

The sample code you posted is virtually identical to code I posted here a
while back. I still works from my box and from many clients that are using
my overnight update software. I get a half a dozen of Emails every morning
telling me that the process has either successfully run or failed.

One interesting problem I ran into a while ago was all of that
http://schemas.microsoft.com/cdo/configuration/ stuff is case sensitive.
Sooo.... If you changed any part of the Schema string to uppercase, you
will get a "transport unavailable" failure. Also make sure that in the
production code you have the trailing slash (/) in the line where you set
the string strSch.

Also I believe these strings are just human readable pointers to a "magic
place" somewhere in cdosys.dll If you are really interested you might want
to start looking here:
http://msdn.microsoft.com/library/d...en-us/e2k3/e2k3/_cdo_schema_configuration.asp
In any case it is OK that you can't browse over to these locations.

The other thing to check is to see if the Email Server Administrator has
recently made any changes to the server which might cause problems with the
authentication code.

Let us know how you make out.

Ron W
www.WorksRite.com
 
B

Brad Pears

Thanks Ron, I am the Exchange admin here as well (jack of all trades -
master of none!) and haven't made any changes. Funny thing is that I was on
vacation last week, first day back today and our Exchange server is having
issues - which might be related the the issues I am seeing re: the CDO
object...

Thanks for you help on the CDO stuff - I do need to read a bit up on that as
I wasn't sure whether or not it really needed access to that URL or if it
was simply a pointer to that "magic" place in the DLL as you so described
it!!
:) ..
THanks,

Brad
 
V

Vimal Ori

Hi Brad,

I also use the same syntax for sending emails through our exchange server
and havent noticed any probolems up to now.
Please keep us posted on your findings in that respect.

however, a while back I had "Mail undeliverable" when trying to send an
email to a user who did not have an internet email address. i.e., some peope
on the domain have external email addresses in the format
(e-mail address removed) while others only have an exchange email box in the
form of their domain username.

The problem seems to have been cured now so I guess it might have to do with
Exchange settings. Funnily, even a person who has an external email address
and who is able to use outlook to send an email cannot get the CDO to send
any email outside the domain. I can only manage to send emails internally
(which fits my current purpose) but it has me perplexed anyway - I am
guessing here that it might have to do with the Exchange server?

Vimal
 

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

Similar Threads

Sending E-mail 3
Sending E-Mail 11
WildCard 16
DoEvents 3
CDO & MailMessage problem 2
Send email to exchange versus SMTP 1
Form Not Visible 2
Sending Access mail using smtp 1

Top