Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert plain text and not attachment
Message
 
To
04/12/2001 09:39:33
General information
Forum:
Visual Basic
Category:
COM, DCOM and OLE automation
Miscellaneous
Thread ID:
00589254
Message ID:
00589261
Views:
30


' Declare VARS
Dim objOutlookApp As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objMail As Outlook.MailItem
Dim FSys As New FileSystemObject
Dim TStream
Dim strBody as Sting

' Set the application objects
Set objOutlookApp = Outlook.Application
Set objNameSpace = objOutlookApp.GetNamespace("MAPI")

' Get Message Body
Set TStream = FSys.OpenTextFile("MyFile.txt", ForReading)
txtLocal.Text = TStream.ReadAll


' Login to Outlook
objNameSpace.Logon

' Set the mail item
Set objMail = objOutlookApp.CreateItem(olMailItem)

' Set properties for the mail item and send mail
With objMail
.To = "steveb@njatc.org"
.Subject = "Message Sent from Visual Basic"
.Body = "This message was created by automating Outlook from VB!"
.Send
End With

' Logoff NameSpace
objNameSpace.Logoff

'Release objects
Set objMail = Nothing
Set objNameSpace = Nothing
Set objOutlookApp = Nothing

End Sub
__________________________________
Stephen W. Boyd
NJATC I.T. Support
steveb@njatc.org

"Our perceptions are our personal realities" ...unknown
Previous
Reply
Map
View

Click here to load this message in the networking platform