System.Win32.SimpleMAPI

Win32-2.5.4.1: A binding to part of the Win32 library

Copyright | (c) Esa Ilari Vuokko 2006
License | BSD-style (see the file LICENSE)
Maintainer | Esa Ilari Vuokko <ei@vuokko.info>
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell98

System.Win32.SimpleMAPI (signature[?])

Description

FFI-bindings to interact with SimpleMAPI

Synopsis

- type ULONG = DWORD
- type LHANDLE = ULONG
- newtype MapiRecipDesc = MapiRecipDesc ()
- type MapiFlag = ULONG
- mAPI_LOGON_UI :: MapiFlag
- mAPI_NEW_SESSION :: MapiFlag
- mAPI_FORCE_DOWNLOAD :: MapiFlag
- mAPI_DIALOG :: MapiFlag
- mAPI_UNREAD_ONLY :: MapiFlag
- mAPI_LONG_MSGID :: MapiFlag
- mAPI_GUARANTEE_FIFO :: MapiFlag
- mAPI_ENVELOPE_ONLY :: MapiFlag
- mAPI_PEEK :: MapiFlag
- mAPI_BODY_AS_FILE :: MapiFlag
- mAPI_SUPPRESS_ATTACH :: MapiFlag
- mAPI_AB_NOMODIFY :: MapiFlag
- mAPI_OLE :: MapiFlag
- mapiErrors :: [(ULONG, String)]
- mAPI_OLE_STATIC :: MapiFlag
- mAPI_UNREAD :: MapiFlag
- mAPI_RECEIPT_REQUESTED :: MapiFlag
- mAPI_SENT :: MapiFlag
- mapiErrorString :: ULONG -> String
- mapiFail :: String -> IO ULONG -> IO ULONG
- mapiFail_ :: String -> IO ULONG -> IO ()
- type MapiLogonType = ULONG -> LPSTR -> LPSTR -> MapiFlag -> ULONG -> Ptr LHANDLE -> IO ULONG
- mkMapiLogon :: FunPtr MapiLogonType -> MapiLogonType
- type MapiLogoffType = LHANDLE -> ULONG -> MapiFlag -> ULONG -> IO ULONG
- mkMapiLogoff :: FunPtr MapiLogoffType -> MapiLogoffType
- type MapiResolveNameType = LHANDLE -> ULONG -> LPSTR -> MapiFlag -> ULONG -> Ptr (Ptr MapiRecipDesc) -> IO ULONG
- mkMapiResolveName :: FunPtr MapiResolveNameType -> MapiResolveNameType
- type MapiFreeBufferType = Ptr () -> IO ULONG
- mkMapiFreeBuffer :: FunPtr MapiFreeBufferType -> MapiFreeBufferType
- type MapiSendMailType = LHANDLE -> ULONG -> Ptr Message -> MapiFlag -> ULONG -> IO ULONG
- mkMapiSendMail :: FunPtr MapiSendMailType -> MapiSendMailType
- data MapiFuncs = MapiFuncs {
  - mapifLogon :: MapiLogonType
  - mapifLogoff :: MapiLogoffType
  - mapifResolveName :: MapiResolveNameType
  - mapifFreeBuffer :: MapiFreeBufferType
  - mapifSendMail :: MapiSendMailType
  }
- type MapiLoaded = (MapiFuncs, ForeignPtr ())
- loadMapiFuncs :: String -> HMODULE -> IO MapiFuncs
- loadMapiDll :: String -> IO (MapiFuncs, HMODULE)
- withMapiFuncs :: [String] -> (MapiFuncs -> IO a) -> IO a
- loadMapi :: [String] -> IO MapiLoaded
- withMapiLoaded :: MapiLoaded -> (MapiFuncs -> IO a) -> IO a
- maybeHWND :: Maybe HWND -> ULONG
- mapiLogon :: MapiFuncs -> Maybe HWND -> Maybe String -> Maybe String -> MapiFlag -> IO LHANDLE
- mapiLogoff :: MapiFuncs -> LHANDLE -> Maybe HWND -> IO ()
- data RecipientClass
  - = RcOriginal
  - | RcTo
  - | RcCc
  - | RcBcc
- rcToULONG :: RecipientClass -> ULONG
- uLONGToRc :: ULONG -> RecipientClass
- data Recipient
  - = RecipResolve (Maybe HWND) MapiFlag String (Maybe Recipient)
  - | Recip String String
- type Recipients = [(RecipientClass, Recipient)]
- simpleRecip :: String -> Recipient
- withRecipient :: MapiFuncs -> LHANDLE -> RecipientClass -> Recipient -> (Ptr MapiRecipDesc -> IO a) -> IO a
- withRecipients :: MapiFuncs -> LHANDLE -> Recipients -> (Int -> Ptr MapiRecipDesc -> IO a) -> IO a
- data FileTag = FileTag {
  - ftTag :: Maybe String
  - ftEncoding :: Maybe String
  }
- defFileTag :: FileTag
- withFileTag :: FileTag -> (Ptr FileTag -> IO a) -> IO a
- data Attachment = Attachment {
  - attFlag :: MapiFlag
  - attPosition :: Maybe ULONG
  - attPath :: String
  - attName :: Maybe String
  - attTag :: Maybe FileTag
  }
- defAttachment :: Attachment
- type Attachments = [Attachment]
- withAttachments :: Attachments -> (Int -> Ptr Attachment -> IO a) -> IO a
- data Message = Message {
  - msgSubject :: String
  - msgBody :: String
  - msgType :: Maybe String
  - msgDate :: Maybe String
  - msgConversationId :: Maybe String
  - msgFlags :: MapiFlag
  - msgFrom :: Maybe Recipient
  - msgRecips :: Recipients
  - msgAttachments :: Attachments
  }
- defMessage :: Message
- withMessage :: MapiFuncs -> LHANDLE -> Message -> (Ptr Message -> IO a) -> IO a
- mapiSendMail :: MapiFuncs -> LHANDLE -> Maybe HWND -> Message -> MapiFlag -> IO ()
- handleIOException :: (IOException -> IO a) -> IO a -> IO a

# Documentation

type ULONG = DWORD Source #

type LHANDLE = ULONG Source #

newtype MapiRecipDesc Source #

Constructors

MapiRecipDesc () |

type MapiFlag = ULONG Source #

mAPI_LOGON_UI :: MapiFlag Source #

mAPI_NEW_SESSION :: MapiFlag Source #

mAPI_FORCE_DOWNLOAD :: MapiFlag Source #

mAPI_DIALOG :: MapiFlag Source #

mAPI_UNREAD_ONLY :: MapiFlag Source #

mAPI_LONG_MSGID :: MapiFlag Source #

mAPI_GUARANTEE_FIFO :: MapiFlag Source #

mAPI_ENVELOPE_ONLY :: MapiFlag Source #

mAPI_PEEK :: MapiFlag Source #

mAPI_BODY_AS_FILE :: MapiFlag Source #

mAPI_SUPPRESS_ATTACH :: MapiFlag Source #

mAPI_AB_NOMODIFY :: MapiFlag Source #

mAPI_OLE :: MapiFlag Source #

mapiErrors :: [(ULONG, String)] Source #

mAPI_OLE_STATIC :: MapiFlag Source #

mAPI_UNREAD :: MapiFlag Source #

mAPI_RECEIPT_REQUESTED :: MapiFlag Source #

mAPI_SENT :: MapiFlag Source #

mapiErrorString :: ULONG -> String Source #

mapiFail :: String -> IO ULONG -> IO ULONG Source #

mapiFail_ :: String -> IO ULONG -> IO () Source #

type MapiLogonType = ULONG -> LPSTR -> LPSTR -> MapiFlag -> ULONG -> Ptr LHANDLE -> IO ULONG Source #

mkMapiLogon :: FunPtr MapiLogonType -> MapiLogonType Source #

type MapiLogoffType = LHANDLE -> ULONG -> MapiFlag -> ULONG -> IO ULONG Source #

mkMapiLogoff :: FunPtr MapiLogoffType -> MapiLogoffType Source #

type MapiResolveNameType = LHANDLE -> ULONG -> LPSTR -> MapiFlag -> ULONG -> Ptr (Ptr MapiRecipDesc) -> IO ULONG Source #

mkMapiResolveName :: FunPtr MapiResolveNameType -> MapiResolveNameType Source #

type MapiFreeBufferType = Ptr () -> IO ULONG Source #

mkMapiFreeBuffer :: FunPtr MapiFreeBufferType -> MapiFreeBufferType Source #

type MapiSendMailType = LHANDLE -> ULONG -> Ptr Message -> MapiFlag -> ULONG -> IO ULONG Source #

mkMapiSendMail :: FunPtr MapiSendMailType -> MapiSendMailType Source #

data MapiFuncs Source #

Constructors

MapiFuncs |
Fields mapifLogon :: MapiLogonType mapifLogoff :: MapiLogoffType mapifResolveName :: MapiResolveNameType mapifFreeBuffer :: MapiFreeBufferType mapifSendMail :: MapiSendMailType

type MapiLoaded = (MapiFuncs, ForeignPtr ()) Source #

loadMapiFuncs :: String -> HMODULE -> IO MapiFuncs Source #

loadMapiDll :: String -> IO (MapiFuncs, HMODULE) Source #

withMapiFuncs :: [String] -> (MapiFuncs -> IO a) -> IO a Source #

loadMapi :: [String] -> IO MapiLoaded Source #

withMapiLoaded :: MapiLoaded -> (MapiFuncs -> IO a) -> IO a Source #

maybeHWND :: Maybe HWND -> ULONG Source #

mapiLogon Source #

Arguments

:: MapiFuncs | Functions loaded from MAPI DLL
-> Maybe HWND | Parent window, used for modal logon dialog
-> Maybe String | Session
-> Maybe String | Password
-> MapiFlag | None, one or many flags: FORCE_DOWNLOAD, NEW_SESSION, LOGON_UI, PASSWORD_UI
-> IO LHANDLE |

Create Simple MAPI-session by logon

mapiLogoff :: MapiFuncs -> LHANDLE -> Maybe HWND -> IO () Source #

End Simple MAPI-session

data RecipientClass Source #

Constructors

RcOriginal |
RcTo |
RcCc |
RcBcc |

Instances

Enum RecipientClass # |
Methods succ :: RecipientClass -> RecipientClass Source # pred :: RecipientClass -> RecipientClass Source # toEnum :: Int -> RecipientClass Source # fromEnum :: RecipientClass -> Int Source # enumFrom :: RecipientClass -> [RecipientClass] Source # enumFromThen :: RecipientClass -> RecipientClass -> [RecipientClass] Source # enumFromTo :: RecipientClass -> RecipientClass -> [RecipientClass] Source # enumFromThenTo :: RecipientClass -> RecipientClass -> RecipientClass -> [RecipientClass] Source #
Eq RecipientClass # |
Methods (==) :: RecipientClass -> RecipientClass -> Bool # (/=) :: RecipientClass -> RecipientClass -> Bool #
Ord RecipientClass # |
Methods compare :: RecipientClass -> RecipientClass -> Ordering # (<) :: RecipientClass -> RecipientClass -> Bool # (<=) :: RecipientClass -> RecipientClass -> Bool # (>) :: RecipientClass -> RecipientClass -> Bool # (>=) :: RecipientClass -> RecipientClass -> Bool # max :: RecipientClass -> RecipientClass -> RecipientClass # min :: RecipientClass -> RecipientClass -> RecipientClass #
Show RecipientClass # |
Methods showsPrec :: Int -> RecipientClass -> ShowS Source # show :: RecipientClass -> String Source # showList :: [RecipientClass] -> ShowS Source #

rcToULONG :: RecipientClass -> ULONG Source #

uLONGToRc :: ULONG -> RecipientClass Source #

data Recipient Source #

Constructors

RecipResolve (Maybe HWND) MapiFlag String (Maybe Recipient) |
Recip String String |

Instances

Show Recipient # |
Methods showsPrec :: Int -> Recipient -> ShowS Source # show :: Recipient -> String Source # showList :: [Recipient] -> ShowS Source #

type Recipients = [(RecipientClass, Recipient)] Source #

simpleRecip :: String -> Recipient Source #

withRecipient :: MapiFuncs -> LHANDLE -> RecipientClass -> Recipient -> (Ptr MapiRecipDesc -> IO a) -> IO a Source #

withRecipients :: MapiFuncs -> LHANDLE -> Recipients -> (Int -> Ptr MapiRecipDesc -> IO a) -> IO a Source #

data FileTag Source #

Constructors

FileTag |
Fields ftTag :: Maybe String mime ftEncoding :: Maybe String

Instances

Show FileTag # |
Methods showsPrec :: Int -> FileTag -> ShowS Source # show :: FileTag -> String Source # showList :: [FileTag] -> ShowS Source #

defFileTag :: FileTag Source #

withFileTag :: FileTag -> (Ptr FileTag -> IO a) -> IO a Source #

data Attachment Source #

Constructors

Attachment |
Fields attFlag :: MapiFlag attPosition :: Maybe ULONG attPath :: String attName :: Maybe String attTag :: Maybe FileTag

Instances

Show Attachment # |
Methods showsPrec :: Int -> Attachment -> ShowS Source # show :: Attachment -> String Source # showList :: [Attachment] -> ShowS Source #

defAttachment :: Attachment Source #

type Attachments = [Attachment] Source #

withAttachments :: Attachments -> (Int -> Ptr Attachment -> IO a) -> IO a Source #

data Message Source #

Constructors

Message |
Fields msgSubject :: String msgBody :: String msgType :: Maybe String msgDate :: Maybe String msgConversationId :: Maybe String msgFlags :: MapiFlag msgFrom :: Maybe Recipient msgRecips :: Recipients msgAttachments :: Attachments

Instances

Show Message # |
Methods showsPrec :: Int -> Message -> ShowS Source # show :: Message -> String Source # showList :: [Message] -> ShowS Source #

defMessage :: Message Source #

withMessage :: MapiFuncs -> LHANDLE -> Message -> (Ptr Message -> IO a) -> IO a Source #

mapiSendMail :: MapiFuncs -> LHANDLE -> Maybe HWND -> Message -> MapiFlag -> IO () Source #

handleIOException :: (IOException -> IO a) -> IO a -> IO a Source #