
09-14-2000, 06:00 AM
|
|
|
Re: send outlook message
|
I use the following code which works fine,
The main differences seem to be my initial setup of the email and the recipient settings.
Public Sub DoEmail(byval strMailAddr As String)
On Error GoTo ProcErr
Dim olApp As Outlook.Application
Dim olSpace As Outlook.NameSpace
Dim olTopFld As Outlook.MAPIFolder ' Object representing top most folder we're looking in
Dim olFldOut As Outlook.MAPIFolder '
Dim olMail As Outlook.MailItem '
Set olApp = New Outlook.Application
Set olSpace = olApp.GetNamespace("MAPI")
Set olTopFld = olSpace.Folders("Mailbox - Application Server")
Set olFldOut = olTopFld.Folders("Outbox")
Set olMail = olFldOut.Items.Add(olMailItem)
With olMail
With .Recipients
.Add strMailAddr
.ResolveAll
End With
.Subject = "Subject"
.Body = "Body"
.Importance = olImportanceHigh
.Send
End With
ProcExit:
Exit Sub
ProcErr:
MsgBox "Error: " & Err.Description
Resume ProcExit
End Sub
Hope this helps.
|
|