Send by Email General MAPI Failure

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
wendy.le
User
Posts: 10
Joined: Wed Oct 14, 2020 10:58 pm

Send by Email General MAPI Failure

Post by wendy.le »

Hello,

We are currently using the PDF-XChange Editor SDK version 8.0.331.0 for a 32-bit GUI application. On machines with Outlook 365 64-bit installed, the Send by Email feature, with Outlook set as the default mail client, would work sometimes and stop working after a random amount of time, throwing the following error:
image.png
image.png (75.82 KiB) Viewed 1402 times

I originally sent this issue to the end-user support email and got a response that the 32-bit DLL should still work with 64-bit Outlook, and if it's not working, it's likely an Outlook issue. At their suggestion, I've reinstalled Outlook but I'm still seeing the same issue. The support person I talked to mentioned some Outlook settings might need to be tweaked to eliminate this problem, but couldn't name any specific settings. I've seen a few other posts with a similar issue to mine but didn't see any posted resolution.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Send by Email General MAPI Failure

Post by Sasha - Tracker Dev Team »

Hello wendy.le,

Does this behavior also reoccur in the End-User Editor with same settings/machines/versions?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
wendy.le
User
Posts: 10
Joined: Wed Oct 14, 2020 10:58 pm

Re: Send by Email General MAPI Failure

Post by wendy.le »

Hi Sasha,

I was able to recreate this issue with the portable app in the same environment.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Send by Email General MAPI Failure

Post by Sasha - Tracker Dev Team »

Hello wendy.le,

Please post this in the End-User forum with the same description, only for the End-User version - there you will be assisted further.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: Send by Email General MAPI Failure

Post by RMan »

If you haven't solved this yet on your end the problem is that Microsoft's MAPI isn't compatible from 32 to 64 bit. I think the MAPISendMail might be the only function that might call 64 bit Outlook from a 32 bit process but not sure on that.

Now if you are talking about only supporting Outlook it's simple in VB6 if you late bind the Outlook API to send an email. That way the exact same code supports 32 or 64 bit Outlook on users machines.

Maybe Tracker's programmers might want to add something like this in when it finds Outlook at 64 bit in a 32 bit version of the Editor or even when the MAPI routines fail.

Code: Select all

'Just copy code to a VB6 form.  No references needed to the Outlook Object Model since it's late bound
Option Explicit

Const olAppointmentItem = 1     'An AppointmentItem object.
Const olContactItem = 2     'A ContactItem object.
Const olDistributionListItem = 7    'A DistListItem object.
Const olJournalItem = 4     'A JournalItem object.
Const olMailItem = 0    'A MailItem object.
Const olNoteItem = 5    'A NoteItem object.
Const olPostItem = 6    'A PostItem object.
Const olTaskItem = 3    'A TaskItem object.


Const olBCC = 3   'The recipient is specified in the BCC property of the Item.
Const olCC = 2     'The recipient is specified in the CC property of the Item.
Const olOriginator = 0     'Originator (sender) of the Item.
Const olTo = 1     'The recipient is specified in the To property of the Item.


Const olImportanceHigh = 2      'Item is marked as high importance.
Const olImportanceLow = 0   'Item is marked as low importance.
Const olImportanceNormal = 1    'Item is marked as medium importance.


Function SendOutlookEmail(sSubject, sMessage, Optional sAttachment = "", Optional sTo = "", Optional bDisplay As Boolean = False) As Boolean
    'Simple function that taks optional attachment and just a single email to

    Dim objOutlook As Object    'Outlook.Application
    Dim objOutlookMsg As Object    'Outlook.MailItem
    Dim objOutlookRecip As Object    'Outlook.Recipient
    Dim objOutlookAttach As Object    'Outlook.Attachment

    ' Create the Outlook session.
    Set objOutlook = CreateObject("Outlook.Application")

    ' Create the message.
    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

    With objOutlookMsg
        ' Add the To recipient(s) to the message.
        Set objOutlookRecip = .Recipients.Add(sTo)
        objOutlookRecip.Type = olTo

        ' Add the CC recipient(s) to the message.
        'Set objOutlookRecip = .Recipients.Add("Andrew Fuller")
        'objOutlookRecip.Type = olCC

        ' Set the Subject, Body, and Importance of the message.
        .Subject = sSubject
        .Body = sMessage
        .Importance = olImportanceNormal

        ' Add attachments to the message.

        If Len(sAttachment) > 0 Then
            If Len(Dir(sAttachment)) > 0 Then
                Set objOutlookAttach = .Attachments.Add(sAttachment)
            End If
        End If

        ' Resolve each Recipient's name.
        For Each objOutlookRecip In .Recipients
            objOutlookRecip.Resolve
            If Not objOutlookRecip.Resolve Then
                objOutlookMsg.Display
            End If
        Next
        If bDisplay = True Then
            .Display
        Else
            .Send
        End If
    End With
    Set objOutlookRecip  = Nothing
    Set objOutlookAttach = Nothing
    Set objOutlookMsg = Nothing
    Set objOutlook = Nothing
End Function

Private Sub Form_Load()
    SendOutlookEmail "Subject Test", "Message Text", App.Path & "\test.pdf", "test@yourserver.com", True
End Sub
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: Send by Email General MAPI Failure

Post by RMan »

Also I'm not 100% sure but if I had to guess they are probably checking this registry key for what the default program for email is so you could do the same and use the above routines if it's Outlook and Outlook is 64 bit and your program is 32 bit.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.eml\UserChoice
String Value Name = Progid

On mine I get Outlook.File.eml.15 if it's Outlook as the default and WindowsLiveMail.Email.1 if it's Live Mail.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Send by Email General MAPI Failure

Post by Sasha - Tracker Dev Team »

Hello RMan,

Thanks for the follow up!

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: Send by Email General MAPI Failure

Post by RMan »

No problem. I also learned that in VB6 it didn't like to start Outlook while still in the PDFEditor_OnEvent code so I had to set a timer to fire off the email after I returned to the OnEvent that we had handled it.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Send by Email General MAPI Failure

Post by Sasha - Tracker Dev Team »

Hello RMan,

Thanks for that info! :)

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply