Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Win MAPI
This example is the version from Tue, 26th Nov 2018.
Project "Win MAPI.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim m as new MapiMessageMBS
dim r as new MapiRecipientMBS
dim o as new MapiRecipientMBS
dim file as new MapiFileMBS
dim t as TextOutputStream
dim f as FolderItem
f=SpecialFolder.Desktop.Child("test.txt")
t=TextOutputStream.Create(f)
t.WriteLine "Test file content"
t.Close
file=new MapiFileMBS
file.Path=f
file.Filename="test file"
file.Position=-1
o.Address="sender@example.com"
o.Name="Me"
o.Type=o.TypeOriginator
r.Address="receiver@example.com"
r.Name="You"
r.Type=o.TypeTo
m.AddFile file
m.AddRecipient r
m.Originator=o
m.Subject="Test Email"
m.NoteText="Hello World"
m.Flags=0
dim SendFlags as integer = m.kSendFlagDialog + m.kSendFlagLogonDialog
title=str(m.SendMail(self, SendFlags, false))
End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
EventHandler Function MouseDown(X As Integer, Y As Integer) As Boolean
ShowURL "http://en.wikipedia.org/wiki/Messaging_Application_Programming_Interface"
End EventHandler
End Control
EventHandler Sub Open()
if MapiMessageMBS.IsAvailable then
MsgBox "MAPI present."
else
MsgBoX "No MAPI?"
end if
End EventHandler
Function FindFile(name as string) As FolderItem
// Look for file in parent folders from executable on
dim parent as FolderItem = app.ExecutableFile.Parent
while parent<>Nil
dim file as FolderItem = parent.Child(name)
if file<>Nil and file.Exists then
Return file
end if
parent = parent.Parent
wend
End Function
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
See also:
The items on this page are in the following plugins: MBS Win Plugin.