CDO Message

S

SHIPP

I obtained the following code from this site. It doesn't work. Most likely my
fault. I believe it is in the configuration. What do each of the .item fields
mean?

Sub CDOTestFive()
'set the following References from the Menu bar under Tools then References
'Microsoft CDO for Windows 2000 Library
'Microsoft ActiveX Data Objects 2.5 Library

Dim iMsg As CDO.Message
Dim iConf As CDO.Configuration
Dim Flds As ADODB.Fields
Dim strHTML As String

On Error GoTo HandleErr

Set iMsg = New CDO.Message
Set iConf = iMsg.Configuration
Set Flds = iConf.Fields

With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"propexbe.propeople.org"

..Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 10
.Update
End With


strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b><p>Please let me know if you got an attachment and
if you could open it. Thanks.</p></b></br>"
strHTML = strHTML & "<b><p>Also please let me know if the text of the
message is bold. Thanks. </b></p>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"

With iMsg
Set .Configuration = iConf
.To = "(e-mail address removed)"
' .CC = "(e-mail address removed)"
.From = "(e-mail address removed)"
.Subject = "Please read: test CDOSYS message with Attachment13"
.HTMLBody = strHTML
.Send
End With

MsgBox "Mail Sent!"

Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

ExitHere:
Exit Sub

HandleErr:
Select Case Err.Number
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical,
strProcName
End Select


End Sub
 
J

JP

You'll get more help if you post this in an Outlook newsgroup, for
example

microsoft.­public.­outlook.­program_vba
microsoft.­public.­office.­developer.­outlook.­vba

Also "it doesn't work" isn't going to inspire someone to help you. You
should post more details such as

What program are you using to do the automating?
What version of Office are you using?
What is the purpose of the code, and the intended outcome?
Are you using Option Explicit?
Did you use Debug>Compile to check for errors before running the code?
If the code runs and then stops, what line does it stop at?


HTH,
JP
 

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