Live Mail - smapi.dll - Windows 7

  • Follow


I'm an MS Access developer.
I've use VBA code to access Windows Live Mail.
In Vista the smapi.dll file worked for me.

In Windows 7 the smapi.dll file no longer works for me.

Does anyone know if there is a difference between the smapi.dll files from 
Vista to Windows 7?

More specifically, in Vista smapi.dll is located here: c:\program 
files\windows live\mail\smapi.dll
In Windows 7 smapi.dll is located here: c:\program files (x86)\windows 
live\mail\smapi.dll

In my VBA code I have the following...
'Declarations below:
'**************************
'   CONSTANT Declarations
'**************************
'


Global Const SUCCESS_SUCCESS = 0
Global Const MAPI_USER_ABORT = 1
Global Const MAPI_E_FAILURE = 2
Global Const MAPI_E_LOGIN_FAILURE = 3
Global Const MAPI_E_DISK_FULL = 4
Global Const MAPI_E_INSUFFICIENT_MEMORY = 5
Global Const MAPI_E_BLK_TOO_SMALL = 6
Global Const MAPI_E_TOO_MANY_SESSIONS = 8
Global Const MAPI_E_TOO_MANY_FILES = 9
Global Const MAPI_E_TOO_MANY_RECIPIENTS = 10
Global Const MAPI_E_ATTACHMENT_NOT_FOUND = 11
Global Const MAPI_E_ATTACHMENT_OPEN_FAILURE = 12
Global Const MAPI_E_ATTACHMENT_WRITE_FAILURE = 13
Global Const MAPI_E_UNKNOWN_RECIPIENT = 14
Global Const MAPI_E_BAD_RECIPTYPE = 15
Global Const MAPI_E_NO_MESSAGES = 16
Global Const MAPI_E_INVALID_MESSAGE = 17
Global Const MAPI_E_TEXT_TOO_LARGE = 18
Global Const MAPI_E_INVALID_SESSION = 19
Global Const MAPI_E_TYPE_NOT_SUPPORTED = 20
Global Const MAPI_E_AMBIGUOUS_RECIPIENT = 21
Global Const MAPI_E_MESSAGE_IN_USE = 22
Global Const MAPI_E_NETWORK_FAILURE = 23
Global Const MAPI_E_INVALID_EDITFIELDS = 24
Global Const MAPI_E_INVALID_RECIPS = 25
Global Const MAPI_E_NOT_SUPPORTED = 26


Global Const MAPI_E_NO_LIBRARY = 999
Global Const MAPI_E_INVALID_PARAMETER = 998


Global Const MAPI_ORIG = 0
Global Const MAPI_TO = 1
Global Const MAPI_CC = 2
Global Const MAPI_BCC = 3


Global Const MAPI_UNREAD = 1
Global Const MAPI_RECEIPT_REQUESTED = 2
Global Const MAPI_SENT = 4


'***********************
'   FLAG Declarations
'***********************


Global Const MAPI_LOGON_UI = &H1
Global Const MAPI_NEW_SESSION = &H2
Global Const MAPI_DIALOG = &H8
Global Const MAPI_UNREAD_ONLY = &H20
Global Const MAPI_ENVELOPE_ONLY = &H40
Global Const MAPI_PEEK = &H80
Global Const MAPI_GUARANTEE_FIFO = &H100
Global Const MAPI_BODY_AS_FILE = &H200
Global Const MAPI_AB_NOMODIFY = &H400
Global Const MAPI_SUPPRESS_ATTACH = &H800
Global Const MAPI_FORCE_DOWNLOAD = &H1000


Global Const MAPI_OLE = &H1
Global Const MAPI_OLE_STATIC = &H2


Type MAPIRecip
    Reserved As Long
    RecipClass As Long
    Name As String
    Address As String
    EIDSize As Long
    EntryID As Long 'Originally String
End Type


Type MAPIFileTag    'Not used at all now
    Reserved As Long
    TagLength As Long
    Tag() As Byte
    EncodingLength As Long
    Encoding() As Byte
End Type


Type MAPIFile
    Reserved As Long
    Flags As Long
    Position As Long
    pathname As String
    FileName As String
    FileType As Long 'Originally MAPIFileTag
End Type


Type MAPIMessage
    Reserved As Long
    Subject As String
    NoteText As String
    MessageType As String
    DateReceived As String
    ConversationID As String
    Flags As Long       ' Swapped with Originator
    Originator As Long  ' Swapped with Flags
    RecipCount As Long
    Recipients As Long
    FileCount As Long   ' Swapped with Files
    Files As Long       ' Swapped with Filecount
End Type


' send mail with windows live mail

Declare Function MAPISendMail Lib "c:\program files\windows 
live\mail\smapi.dll" ( _
    ByVal Session As Long, _
    ByVal UIParam As Long, _
    Message As MAPIMessage, _
    ByVal Flags As Long, _
    ByVal Reserved As Long) As Long

Declare Function MAPISendMail64 Lib "c:\program files (x86)\windows 
live\mail\smapi.dll" ( _
    ByVal Session As Long, _
    ByVal UIParam As Long, _
    Message As MAPIMessage, _
    ByVal Flags As Long, _
    ByVal Reserved As Long) As Long


Can I rename the function to MAPISendMail64?

Thanks,

Rick 

0
Reply rick 6/4/2010 1:12:08 AM

The API for WLM has not been made public..I don't recall any information available that would answer your question.

-- 
  ...winston
  ms-mvp mail

"rick allison" <allisonrja@hotmail.com> wrote in message news:6C2BFAA4-60EF-4BE6-8808-F7652D26B6F4@microsoft.com...
> I'm an MS Access developer.
> I've use VBA code to access Windows Live Mail.
> In Vista the smapi.dll file worked for me.
> 
> In Windows 7 the smapi.dll file no longer works for me.
> 
> Does anyone know if there is a difference between the smapi.dll files from 
> Vista to Windows 7?
> 
> More specifically, in Vista smapi.dll is located here: c:\program 
> files\windows live\mail\smapi.dll
> In Windows 7 smapi.dll is located here: c:\program files (x86)\windows 
> live\mail\smapi.dll
> 
> 
0
Reply winston 6/4/2010 2:42:08 AM


Why use the WLM version of that file directly? If you use the system's 
mapi32.dll it will use the default mail client on the machine.

-geoff

"...winston"  wrote in message news:OY7Llg5ALHA.1892@TK2MSFTNGP05.phx.gbl...

The API for WLM has not been made public..I don't recall any information 
available that would answer your question.

-- 
  ...winston
  ms-mvp mail

"rick allison" <allisonrja@hotmail.com> wrote in message 
news:6C2BFAA4-60EF-4BE6-8808-F7652D26B6F4@microsoft.com...
> I'm an MS Access developer.
> I've use VBA code to access Windows Live Mail.
> In Vista the smapi.dll file worked for me.
>
> In Windows 7 the smapi.dll file no longer works for me.
>
> Does anyone know if there is a difference between the smapi.dll files from 
> Vista to Windows 7?
>
> More specifically, in Vista smapi.dll is located here: c:\program 
> files\windows live\mail\smapi.dll
> In Windows 7 smapi.dll is located here: c:\program files (x86)\windows 
> live\mail\smapi.dll
>
> 

0
Reply Geoff 6/4/2010 11:36:10 AM

The difference in file locations is because you are running a 32 bit 
version of Vista and a 64 bit version of Win7.

On a 64 bit version of Windows, 32 bit applications get installed to
 c:\program files (x86)

-- 

Mike - http://TechHelp.Santovec.us



"rick allison" <allisonrja@hotmail.com> wrote in message 
news:6C2BFAA4-60EF-4BE6-8808-F7652D26B6F4@microsoft.com...
> I'm an MS Access developer.
> I've use VBA code to access Windows Live Mail.
> In Vista the smapi.dll file worked for me.
>
> In Windows 7 the smapi.dll file no longer works for me.
>
> Does anyone know if there is a difference between the smapi.dll files 
> from Vista to Windows 7?
>
> More specifically, in Vista smapi.dll is located here: c:\program 
> files\windows live\mail\smapi.dll
> In Windows 7 smapi.dll is located here: c:\program files (x86)\windows 
> live\mail\smapi.dll
>
> In my VBA code I have the following...
> 'Declarations below:
> '**************************
> '   CONSTANT Declarations
> '**************************
> '
>
>
> Global Const SUCCESS_SUCCESS = 0
> Global Const MAPI_USER_ABORT = 1
> Global Const MAPI_E_FAILURE = 2
> Global Const MAPI_E_LOGIN_FAILURE = 3
> Global Const MAPI_E_DISK_FULL = 4
> Global Const MAPI_E_INSUFFICIENT_MEMORY = 5
> Global Const MAPI_E_BLK_TOO_SMALL = 6
> Global Const MAPI_E_TOO_MANY_SESSIONS = 8
> Global Const MAPI_E_TOO_MANY_FILES = 9
> Global Const MAPI_E_TOO_MANY_RECIPIENTS = 10
> Global Const MAPI_E_ATTACHMENT_NOT_FOUND = 11
> Global Const MAPI_E_ATTACHMENT_OPEN_FAILURE = 12
> Global Const MAPI_E_ATTACHMENT_WRITE_FAILURE = 13
> Global Const MAPI_E_UNKNOWN_RECIPIENT = 14
> Global Const MAPI_E_BAD_RECIPTYPE = 15
> Global Const MAPI_E_NO_MESSAGES = 16
> Global Const MAPI_E_INVALID_MESSAGE = 17
> Global Const MAPI_E_TEXT_TOO_LARGE = 18
> Global Const MAPI_E_INVALID_SESSION = 19
> Global Const MAPI_E_TYPE_NOT_SUPPORTED = 20
> Global Const MAPI_E_AMBIGUOUS_RECIPIENT = 21
> Global Const MAPI_E_MESSAGE_IN_USE = 22
> Global Const MAPI_E_NETWORK_FAILURE = 23
> Global Const MAPI_E_INVALID_EDITFIELDS = 24
> Global Const MAPI_E_INVALID_RECIPS = 25
> Global Const MAPI_E_NOT_SUPPORTED = 26
>
>
> Global Const MAPI_E_NO_LIBRARY = 999
> Global Const MAPI_E_INVALID_PARAMETER = 998
>
>
> Global Const MAPI_ORIG = 0
> Global Const MAPI_TO = 1
> Global Const MAPI_CC = 2
> Global Const MAPI_BCC = 3
>
>
> Global Const MAPI_UNREAD = 1
> Global Const MAPI_RECEIPT_REQUESTED = 2
> Global Const MAPI_SENT = 4
>
>
> '***********************
> '   FLAG Declarations
> '***********************
>
>
> Global Const MAPI_LOGON_UI = &H1
> Global Const MAPI_NEW_SESSION = &H2
> Global Const MAPI_DIALOG = &H8
> Global Const MAPI_UNREAD_ONLY = &H20
> Global Const MAPI_ENVELOPE_ONLY = &H40
> Global Const MAPI_PEEK = &H80
> Global Const MAPI_GUARANTEE_FIFO = &H100
> Global Const MAPI_BODY_AS_FILE = &H200
> Global Const MAPI_AB_NOMODIFY = &H400
> Global Const MAPI_SUPPRESS_ATTACH = &H800
> Global Const MAPI_FORCE_DOWNLOAD = &H1000
>
>
> Global Const MAPI_OLE = &H1
> Global Const MAPI_OLE_STATIC = &H2
>
>
> Type MAPIRecip
>    Reserved As Long
>    RecipClass As Long
>    Name As String
>    Address As String
>    EIDSize As Long
>    EntryID As Long 'Originally String
> End Type
>
>
> Type MAPIFileTag    'Not used at all now
>    Reserved As Long
>    TagLength As Long
>    Tag() As Byte
>    EncodingLength As Long
>    Encoding() As Byte
> End Type
>
>
> Type MAPIFile
>    Reserved As Long
>    Flags As Long
>    Position As Long
>    pathname As String
>    FileName As String
>    FileType As Long 'Originally MAPIFileTag
> End Type
>
>
> Type MAPIMessage
>    Reserved As Long
>    Subject As String
>    NoteText As String
>    MessageType As String
>    DateReceived As String
>    ConversationID As String
>    Flags As Long       ' Swapped with Originator
>    Originator As Long  ' Swapped with Flags
>    RecipCount As Long
>    Recipients As Long
>    FileCount As Long   ' Swapped with Files
>    Files As Long       ' Swapped with Filecount
> End Type
>
>
> ' send mail with windows live mail
>
> Declare Function MAPISendMail Lib "c:\program files\windows 
> live\mail\smapi.dll" ( _
>    ByVal Session As Long, _
>    ByVal UIParam As Long, _
>    Message As MAPIMessage, _
>    ByVal Flags As Long, _
>    ByVal Reserved As Long) As Long
>
> Declare Function MAPISendMail64 Lib "c:\program files (x86)\windows 
> live\mail\smapi.dll" ( _
>    ByVal Session As Long, _
>    ByVal UIParam As Long, _
>    Message As MAPIMessage, _
>    ByVal Flags As Long, _
>    ByVal Reserved As Long) As Long
>
>
> Can I rename the function to MAPISendMail64?
>
> Thanks,
>
> Rick 


0
Reply Michael 6/4/2010 9:12:21 PM

Oh no, no API.

I took the code I had for Outlook Express and used it.  I had to remove the 
file attachment variable to make it work.

"...winston" <winstonmvp@gmail.com> wrote in message 
news:OY7Llg5ALHA.1892@TK2MSFTNGP05.phx.gbl...
> The API for WLM has not been made public..I don't recall any information 
> available that would answer your question.
>
> -- 
>  ...winston
>  ms-mvp mail
>
> "rick allison" <allisonrja@hotmail.com> wrote in message 
> news:6C2BFAA4-60EF-4BE6-8808-F7652D26B6F4@microsoft.com...
>> I'm an MS Access developer.
>> I've use VBA code to access Windows Live Mail.
>> In Vista the smapi.dll file worked for me.
>>
>> In Windows 7 the smapi.dll file no longer works for me.
>>
>> Does anyone know if there is a difference between the smapi.dll files 
>> from Vista to Windows 7?
>>
>> More specifically, in Vista smapi.dll is located here: c:\program 
>> files\windows live\mail\smapi.dll
>> In Windows 7 smapi.dll is located here: c:\program files (x86)\windows 
>> live\mail\smapi.dll
>>
>> 
0
Reply rick 6/7/2010 4:15:59 PM

I want to force the use of WLM and not make the user have to use WLM as 
their default mail system.  Many of my customers want to use Outlook as 
their default mail system and I cannot programmatically turn off the warning 
message about sending email from another program.  As far as I know, this 
warning message cannot be turned of from Outlook like it can from WLM.

Rick

"Geoff Clark (MSFT)" <geoffcl@hotmail.com> wrote in message 
news:eCowio9ALHA.4308@TK2MSFTNGP04.phx.gbl...
> Why use the WLM version of that file directly? If you use the system's 
> mapi32.dll it will use the default mail client on the machine.
>
> -geoff
>
> "...winston"  wrote in message 
> news:OY7Llg5ALHA.1892@TK2MSFTNGP05.phx.gbl...
>
> The API for WLM has not been made public..I don't recall any information 
> available that would answer your question.
>
> -- 
>  ...winston
>  ms-mvp mail
>
> "rick allison" <allisonrja@hotmail.com> wrote in message 
> news:6C2BFAA4-60EF-4BE6-8808-F7652D26B6F4@microsoft.com...
>> I'm an MS Access developer.
>> I've use VBA code to access Windows Live Mail.
>> In Vista the smapi.dll file worked for me.
>>
>> In Windows 7 the smapi.dll file no longer works for me.
>>
>> Does anyone know if there is a difference between the smapi.dll files 
>> from Vista to Windows 7?
>>
>> More specifically, in Vista smapi.dll is located here: c:\program 
>> files\windows live\mail\smapi.dll
>> In Windows 7 smapi.dll is located here: c:\program files (x86)\windows 
>> live\mail\smapi.dll
>>
>>
> 
0
Reply rick 6/7/2010 4:17:54 PM

Update on what has happened.

I created another module in Access (WLM32in64) because I have to hard code 
the folder in the function
Declare Function MAPISendMail Lib "c:\program files (x86)\windows 
live\mail\smapi.dll" ( _
    ByVal Session As Long, _
    ByVal UIParam As Long, _
    Message As MAPIMessage, _
    ByVal Flags As Long, _
    ByVal Reserved As Long) As Long

When I did this it works.

What I've learned...
1) the function must be called MAPISendMail.
2) in Windows 7 the first and second attempt to send an email fail, the 
third attempt succeeds.  This happens only on the first attempt to send an 
email with windows live mail and the MAPISendMail function.  I have no idea 
why.
Code to make sending mail work for the very first email sent.
MAPISendMail
If MAPIError then
    MAPISendMail
        if MAPIError then
            MAPISendMail - the email is sent on the third attempt.
        end if
end if

What's strange is this, in Vista MAPISendMail has to try twice  and in 
Windows XP it works every time on the first attempt.
Remember, this is for the very first email being sent from MS Access upon 
opening of the MS Access program.  Once the first email attempt is complete, 
every email after that works on the first attempt.  No need to try two or 
three times.  That's just plain weird to me.  But heck it works.

I hope this helps someone else.

If there is a better way to do this, I'm very interested.

Rick

"Michael Santovec" <michael@santovec.XXX> wrote in message 
news:uweLiqCBLHA.4584@TK2MSFTNGP06.phx.gbl...
> The difference in file locations is because you are running a 32 bit 
> version of Vista and a 64 bit version of Win7.
>
> On a 64 bit version of Windows, 32 bit applications get installed to
> c:\program files (x86)
>
> -- 
>
> Mike - http://TechHelp.Santovec.us
>
>
>
> "rick allison" <allisonrja@hotmail.com> wrote in message 
> news:6C2BFAA4-60EF-4BE6-8808-F7652D26B6F4@microsoft.com...
>> I'm an MS Access developer.
>> I've use VBA code to access Windows Live Mail.
>> In Vista the smapi.dll file worked for me.
>>
>> In Windows 7 the smapi.dll file no longer works for me.
>>
>> Does anyone know if there is a difference between the smapi.dll files 
>> from Vista to Windows 7?
>>
>> More specifically, in Vista smapi.dll is located here: c:\program 
>> files\windows live\mail\smapi.dll
>> In Windows 7 smapi.dll is located here: c:\program files (x86)\windows 
>> live\mail\smapi.dll
>>
>> In my VBA code I have the following...
>> 'Declarations below:
>> '**************************
>> '   CONSTANT Declarations
>> '**************************
>> '
>>
>>
>> Global Const SUCCESS_SUCCESS = 0
>> Global Const MAPI_USER_ABORT = 1
>> Global Const MAPI_E_FAILURE = 2
>> Global Const MAPI_E_LOGIN_FAILURE = 3
>> Global Const MAPI_E_DISK_FULL = 4
>> Global Const MAPI_E_INSUFFICIENT_MEMORY = 5
>> Global Const MAPI_E_BLK_TOO_SMALL = 6
>> Global Const MAPI_E_TOO_MANY_SESSIONS = 8
>> Global Const MAPI_E_TOO_MANY_FILES = 9
>> Global Const MAPI_E_TOO_MANY_RECIPIENTS = 10
>> Global Const MAPI_E_ATTACHMENT_NOT_FOUND = 11
>> Global Const MAPI_E_ATTACHMENT_OPEN_FAILURE = 12
>> Global Const MAPI_E_ATTACHMENT_WRITE_FAILURE = 13
>> Global Const MAPI_E_UNKNOWN_RECIPIENT = 14
>> Global Const MAPI_E_BAD_RECIPTYPE = 15
>> Global Const MAPI_E_NO_MESSAGES = 16
>> Global Const MAPI_E_INVALID_MESSAGE = 17
>> Global Const MAPI_E_TEXT_TOO_LARGE = 18
>> Global Const MAPI_E_INVALID_SESSION = 19
>> Global Const MAPI_E_TYPE_NOT_SUPPORTED = 20
>> Global Const MAPI_E_AMBIGUOUS_RECIPIENT = 21
>> Global Const MAPI_E_MESSAGE_IN_USE = 22
>> Global Const MAPI_E_NETWORK_FAILURE = 23
>> Global Const MAPI_E_INVALID_EDITFIELDS = 24
>> Global Const MAPI_E_INVALID_RECIPS = 25
>> Global Const MAPI_E_NOT_SUPPORTED = 26
>>
>>
>> Global Const MAPI_E_NO_LIBRARY = 999
>> Global Const MAPI_E_INVALID_PARAMETER = 998
>>
>>
>> Global Const MAPI_ORIG = 0
>> Global Const MAPI_TO = 1
>> Global Const MAPI_CC = 2
>> Global Const MAPI_BCC = 3
>>
>>
>> Global Const MAPI_UNREAD = 1
>> Global Const MAPI_RECEIPT_REQUESTED = 2
>> Global Const MAPI_SENT = 4
>>
>>
>> '***********************
>> '   FLAG Declarations
>> '***********************
>>
>>
>> Global Const MAPI_LOGON_UI = &H1
>> Global Const MAPI_NEW_SESSION = &H2
>> Global Const MAPI_DIALOG = &H8
>> Global Const MAPI_UNREAD_ONLY = &H20
>> Global Const MAPI_ENVELOPE_ONLY = &H40
>> Global Const MAPI_PEEK = &H80
>> Global Const MAPI_GUARANTEE_FIFO = &H100
>> Global Const MAPI_BODY_AS_FILE = &H200
>> Global Const MAPI_AB_NOMODIFY = &H400
>> Global Const MAPI_SUPPRESS_ATTACH = &H800
>> Global Const MAPI_FORCE_DOWNLOAD = &H1000
>>
>>
>> Global Const MAPI_OLE = &H1
>> Global Const MAPI_OLE_STATIC = &H2
>>
>>
>> Type MAPIRecip
>>    Reserved As Long
>>    RecipClass As Long
>>    Name As String
>>    Address As String
>>    EIDSize As Long
>>    EntryID As Long 'Originally String
>> End Type
>>
>>
>> Type MAPIFileTag    'Not used at all now
>>    Reserved As Long
>>    TagLength As Long
>>    Tag() As Byte
>>    EncodingLength As Long
>>    Encoding() As Byte
>> End Type
>>
>>
>> Type MAPIFile
>>    Reserved As Long
>>    Flags As Long
>>    Position As Long
>>    pathname As String
>>    FileName As String
>>    FileType As Long 'Originally MAPIFileTag
>> End Type
>>
>>
>> Type MAPIMessage
>>    Reserved As Long
>>    Subject As String
>>    NoteText As String
>>    MessageType As String
>>    DateReceived As String
>>    ConversationID As String
>>    Flags As Long       ' Swapped with Originator
>>    Originator As Long  ' Swapped with Flags
>>    RecipCount As Long
>>    Recipients As Long
>>    FileCount As Long   ' Swapped with Files
>>    Files As Long       ' Swapped with Filecount
>> End Type
>>
>>
>> ' send mail with windows live mail
>>
>> Declare Function MAPISendMail Lib "c:\program files\windows 
>> live\mail\smapi.dll" ( _
>>    ByVal Session As Long, _
>>    ByVal UIParam As Long, _
>>    Message As MAPIMessage, _
>>    ByVal Flags As Long, _
>>    ByVal Reserved As Long) As Long
>>
>> Declare Function MAPISendMail64 Lib "c:\program files (x86)\windows 
>> live\mail\smapi.dll" ( _
>>    ByVal Session As Long, _
>>    ByVal UIParam As Long, _
>>    Message As MAPIMessage, _
>>    ByVal Flags As Long, _
>>    ByVal Reserved As Long) As Long
>>
>>
>> Can I rename the function to MAPISendMail64?
>>
>> Thanks,
>>
>> Rick
>
> 
0
Reply rick 6/16/2010 1:53:31 PM

6 Replies
1041 Views

(page loaded in 0.004 seconds)


Reply: