# Revision history [back]

LibreOffice's strategy to send mail is very simple. It is defined in its senddoc.cxx, and in layman terms may be described like this: "use one single MS API to do everything".

Specifically, it prepares all email information (recipients, mail body, attachments), and then calls MAPISendMailHelper (Simple MAPI) function. This is all what LibreOffice code does. So the end result depends on what MS MAPISendMailHelper function does itself.

Now let's see what MS code does, so that you can check if any mail client fulfills Microsoft expectations for proper default Simple MAPI provider registration. Briefly it's described here, but the function's source code is available in MS SDKs, and we can consult it to see it in greater details.

1. It calls LoadLibraryW(L"mapi32.dll"); to load mapi32.dll library (it's a MS standard library normally found in Windows\System32 directory). It checks if the library has function named MAPISendMailW, and if it is present, simply calls it (it is true for Windows 8.0 and newer).
2. Otherwise, it proceeds with explicit search for mail provider calling a function appropriately named LoadDefaultMailProvider.
3. The latter (indirectly) checks registry under both HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE (in that order) for key Software\Clients\Mail.
4. Then it checks if the calling application (in our case, it's LibreOffice's senddoc.exe) wants a specific mail provider (checking HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem\MSMapiApps). Note: LibreOffice itself doesn't write any explicit requirements there, so the check should not normally result in any explicit requirement.
5. Then, it checks the provider name in the default value under Software\Clients\Mail (this is finally where the true default mail provider is registered!).
6. Then it opens the subkey under Software\Clients\Mail with the name found at previous step. It checks if the provider is installed on demand, and if required, tries to install it on demand.
7. After that, it checks the key opened on the previous step for DLLPath value, to get the actual MAPI dll provided by the default Mail application.
8. If previous checks (under HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE) failed, it tries to load mapi32x.dll. Possibly that is what makes the fallback to the "Outlook trial program" on your system, and that means that the "emClient" isn't properly registered on your system (despite it claims to support Simple MAPI at least for its "IceWrap" application).
9. It opens the selected library, and tries to call MAPISendMailW in it.
10. If the previous step failed, it falls back to mapi32.dll's MAPISendMail. Here, again, fallback could happen.

The steps above may give you hints where to look for the missing registration bits. It may turn out that your email program doesn't support Simple MAPI at all; or it might not register properly. You might then file some support request against your mail application's vendor.

LibreOffice's strategy to send mail on Windows is very simple. It is defined in its senddoc.cxx, and in layman terms may be described like this: "use one single MS API to do everything".

Specifically, it prepares all email information (recipients, mail body, attachments), and then calls MAPISendMailHelper (Simple MAPI) function. This is all what LibreOffice code does. So the end result depends on what MS MAPISendMailHelper function does itself.

Now let's see what MS code does, so that you can check if any mail client fulfills Microsoft expectations for proper default Simple MAPI provider registration. Briefly it's described here, but the function's source code is available in MS SDKs, and we can consult it to see it in greater details.

1. It calls LoadLibraryW(L"mapi32.dll"); to load mapi32.dll library (it's a MS standard library normally found in Windows\System32 directory). It checks if the library has function named MAPISendMailW, and if it is present, simply calls it (it is true for Windows 8.0 and newer).
2. Otherwise, it proceeds with explicit search for mail provider calling a function appropriately named LoadDefaultMailProvider.
• The latter (indirectly) checks registry under both HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE (in that order) for key Software\Clients\Mail.
• Then it checks if the calling application (in our case, it's LibreOffice's senddoc.exe) wants a specific mail provider (checking HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem\MSMapiApps). Note: LibreOffice itself doesn't write any explicit requirements there, so the check should not normally result in any explicit requirement.
• Then, it checks the provider name in the default value under Software\Clients\Mail (this is finally where the true default mail provider is registered!).
• Then it opens the subkey under Software\Clients\Mail with the name found at previous step. It checks if the provider is installed on demand, and if required, tries to install it on demand.
• After that, it checks the key opened on the previous step for DLLPath value, to get the actual MAPI dll provided by the default Mail application.
• If previous checks (under HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE) failed, it tries to load mapi32x.dll. Possibly that is what makes the fallback to the "Outlook trial program" on your system, and that means that the "emClient" isn't properly registered on your system (despite it claims to support Simple MAPI at least for its "IceWrap" application).MAPI).
• It opens the selected library, and tries to call MAPISendMailW in it.
1. If the previous step failed, it falls back to mapi32.dll's MAPISendMail. Here, again, fallback could happen.

The steps above may give you hints where to look for the missing registration bits. It may turn out that your email program doesn't support Simple MAPI at all; or it might not register properly. You might then file some support request against your mail application's vendor.

LibreOffice's strategy to send mail on Windows is very simple. It is defined in its senddoc.cxx, and in layman terms may be described like this: "use one single MS API to do everything".

Specifically, it prepares all email information (recipients, mail body, attachments), and then calls MAPISendMailHelper (Simple MAPI) function. This is all what LibreOffice code does. So the end result depends on what MS MAPISendMailHelper function does itself.

Now let's see what MS code does, so that you can check if any mail client fulfills Microsoft expectations for proper default Simple MAPI provider registration. Briefly it's described here, but the function's source code is available in MS SDKs, and we can consult it to see it in greater details.

1. It calls LoadLibraryW(L"mapi32.dll"); to load mapi32.dll library (it's a MS standard library normally found in Windows\System32 directory). It checks if the library has function named MAPISendMailW, and if it is present, simply calls it (it is true for Windows 8.0 and newer).
2. Otherwise, it proceeds with explicit search for mail provider calling a function appropriately named LoadDefaultMailProvider.
• The latter (indirectly) checks registry under both HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE (in that order) for key Software\Clients\Mail.
• Then it checks if the calling application (in our case, it's LibreOffice's senddoc.exe) wants a specific mail provider (checking HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem\MSMapiApps). Note: LibreOffice itself doesn't write any explicit requirements there, so the check should not normally result in any explicit requirement.
• Then, it checks the provider name in the default value under Software\Clients\Mail (this is finally where the true default mail provider is registered!).
• Then it opens the subkey under Software\Clients\Mail with the name found at previous step. It checks if the provider is installed on demand, and if required, tries to install it on demand.
• After that, it checks the key opened on the previous step for DLLPath value, to get the actual MAPI dll provided by the default Mail application.
• If previous checks (under HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE) failed, it tries to load mapi32x.dll. Possibly that is what makes the fallback to the "Outlook trial program" on your system, and that means that the "emClient" isn't properly registered on your system (despite it claims to support Simple MAPI).
• It opens the selected library, and tries to call MAPISendMailW in it.
1. If the previous step failed, it falls back to mapi32.dll's MAPISendMail. Here, again, fallback could happen.

The steps above may give you hints where to look for the missing registration bits. It may turn out that your email program doesn't support Simple MAPI at all; or it might not register properly. You might then file some support request against your mail application's vendor.