Messaging Confusion

J

JonWayne

Forgive me if this isnt the right forum for what I am about to query.

I will paste two blocks of messaging codes below, both using CDO, but
different in implementation. The first block I will refer to as Block1 and
the second Block2. First off, let me say I am confused because even though
the two are CDO technologies, they are different - having different
properties and methods. For the most part, I want to use Block2, because it
synchronizes with my local copy of Outlook 2003 - IOW: The Outbox will show
that there is a message going out after I execute the Send method. What I
find missing in Block2, that is available to Block1, is the HTMLBody
property. To make an already long post short, let me skip to the chase here.
I have a function that returns a table in HTML , how can I get Block2 to
send the table , not the markup text? It had a TextBody property but no
HtmlBody. Or, how can I setup Block1 so that it syncs with my Outlook
program?

Block1:
============================================================================
======
Sub CDOSender()
Dim objMessage As Object

Set objMessage = CreateObject("CDO.Message") 'Create
the message object.

With objMessage
.From = """Wayne""<[email protected]>"
.To = "(e-mail address removed)"
.Subject = "An Email From Active Call Center."
'.TextBody = "This is some sample message text.."
.HTMLBody = strHTML
.AddAttachment ("c:\working\access\wayneallcounty.mdb") 'Add
attachment

With .Configuration.Fields

..Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPort

..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mail.zz.net"

..Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =
cdoBasic

..Item("http://schemas.microsoft.com/cdo/configuration/sendusername") =
"(e-mail address removed)"

..Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "wn"

..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

..Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

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

.Send 'Send message
End With
End Sub

Block2:
==========================================================================
Sub CDO()
Dim Msg As Object, AddrEntries As Object, AddrEntry As Object, Sess As
Object, AddrListColl As Object
Dim AddrListsColl As Object, AddrList As Object, Attchmt As Object
Dim fAddressExist As Boolean, Recips As Object, Recip As Object
Dim fso As FileSystemObject, RecFile As File, TS As TextStream,
AllCountyFile As File
Dim AttachFile$
Const CdoFileData& = 1

Set Sess = CreateObject("MAPI.Session")
Sess.Logon ProfileName:="Outlook", NewSession:=False

If Sess Is Nothing Then
MsgBox "Unable to logon to MAPI messaging system"
End
End If

Set AddrListsColl = Sess.AddressLists
Set AddrList = AddrListsColl(1)
Set AddrEntries = AddrList.AddressEntries
Set AddrEntry = AddrEntries(1)
Set Msg = Sess.Outbox.Messages.Add

With Msg
.Subject = "yayaya"
.Text = "(TS)"
Set Recip = .Recipients.Add
Recip.Name = AddrEntry.Name
Recip.Resolve
Set Attchmt = .Attachments.Add(AllCountyFilename, 0, CdoFileData,
AttachFile)
.Send
End With

Sess.Logoff
End Sub
 
B

Brian Tillman

JonWayne said:
Forgive me if this isnt the right forum for what I am about to query.

Try news://msnews.microsoft.com/microsoft.public.outlook.program_vba
 

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