Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Email sending fails

edited August 2012 in General
I have implemented routines (as found in rbWiki How to...Email Groups) for
sending each group in a report by email.
The solution was tested on my computer and things worked as expected...
When deployed at customer, no email is sent although the pdf file is created
as expected.

Any Ideas on where to start looking?
Where can I trap errors?

Customer computer:
Win7
Outlook 2010

Regards
Petter
Delphi 2010
ReportBuilder 14.05

Comments

  • edited August 2012
    If Win7 is at 64 bit and Outlook 2010 is at 64 bit, the problem is new
    Mapi at 64 bit.
    I resolved with EasyMapi and ppSMTPEasyMapi.

    Best Regards
    Massimo Voto

    Il 26/08/12 19.40, Petter Topp ha scritto:
  • edited August 2012
    Hi Massimo.

    Could you elaborate on this?

    Petter

    "Massimo Voto" skrev i nyhetsmeldingen: 503b4b37$1@mail. ...

    If Win7 is at 64 bit and Outlook 2010 is at 64 bit, the problem is new
    Mapi at 64 bit.
    I resolved with EasyMapi and ppSMTPEasyMapi.

    Best Regards
    Massimo Voto

    Il 26/08/12 19.40, Petter Topp ha scritto:
  • edited August 2012
    Hi Peter
    Sorry for my english ;-).
    If you see this page
    http://msdn.microsoft.com/en-us/library/dd941355(office.14).aspx
    you'll find information about the new Microsoft MAPI. I have had
    problems with sending emails since I came the first 64-bit machines, and
    especially with Outlook.
    I did all kinds of tests, and I finally solved using EasyMapi. It worked
    the first time. You must, however, make two changes to ppSMTPEasyMapi
    Report Builder that you attach

    1) In your project, add the call to the unit ppSMTPEasyMapi;
    2) In your procedure call Plugin EasyMapi and rem plugin SMTPMail

    procedure SendMyMail;
    begin
    Screen.cursor:=crhourglass;

    //TppSMTPPlugIn.RegisterClass(TppSMTPMapi);
    TppSMTPPlugIn.RegisterClass(TppSMTPEasyMapi);

    TppEmail(ppReport1.Email).SMTP.OnEmailError := EmailErrorEvent;
    ppReport1.PDFSettings.OpenPDFFile:=false;
    ppReport1.EmailSettings.ShowEmailDialog := False;
    ppReport1.EmailSettings.PreviewInEmailClient := True;
    ppReport1.EmailSettings.FileName:=.....
    ppReport1.AllowPrintToFile:=false;
    ppReport1.ShowPrintDialog:=true;
    ppReport1.DeviceType:='Screen';
    ppReport1.PrintToDevices;
    ppReport1.SendMail;
    Screen.cursor:=crdefault;
    end;

    3) Correct in ppSMTPEasyMapi the constructor Create and add
    FSession.MAPIClient:=FSession.MAPIInfo.DefaultClient;

    constructor TppSMTPEasyMAPI.Create;
    begin

    inherited Create;

    FSession := TRwMapiSession.Create(nil);
    FSession.LogonInfo.ShowLogonDialog := False;
    FSession.LogonInfo.UseExtendedMapi := true;
    FSession.LogonInfo.NewSession := True;

    // FStatusTable := MapiSession.GetStatusTable; ??? MapiSession ???
    // FStatusTable := FSession.GetStatusTable;

    {$ifdef RAP_EASYMAPI_6}
    FMessageFormat := fmtPlainText;
    FSession.MAPIClient:=FSession.MAPIInfo.DefaultClient;
    {$else}
    FMessageFormat := mtfPlainText;
    {$endif}

    end; {constructor, Create}

    4) Correct in ppSMTPEasyMapi the constructor Connect with try/except/end
    function TppSMTPEasyMAPI.Connect: Boolean;
    begin

    if not FSession.Active then
    FSession.Logon;

    try
    if FSession.Active then
    FStatusTable := FSession.GetStatusTable
    else
    FStatusTable := NIL;
    except
    FStatusTable:=nil;
    end;

    Result := FSession.Active;

    end; {function, Connect}

    5) In the machine at s.o. 64 bit and email client at 64 bit, for
    software at 32 bit (all excluse Delphi XE2) execute RWEasyMapi64.exe

    6) It's possible use the trial version of EasyMapi for test your
    application.

    7) Good job. This is my experience, I hope to check out the state aid. I
    use Delphi XE and ReportBuilder Enterprise 14.06.

    Massimo

    Il 27/08/12 13.04, Petter Topp ha scritto:
  • edited August 2012
    Hi Nard / Nico.

    Is this a known issue with the "mail client" of ReportBuilder?
    Will you provide a fix?

    Regards
    Petter



    "Petter Topp" skrev i nyhetsmeldingen: 503a6008$1@mail. ...

    I have implemented routines (as found in rbWiki How to...Email Groups) for
    sending each group in a report by email.
    The solution was tested on my computer and things worked as expected...
    When deployed at customer, no email is sent although the pdf file is created
    as expected.

    Any Ideas on where to start looking?
    Where can I trap errors?

    Customer computer:
    Win7
    Outlook 2010

    Regards
    Petter
    Delphi 2010
    ReportBuilder 14.05
  • edited August 2012
    1. Check whether the customer's machine has Outlook configured as the
    default email program. The most common issue is that no default email
    program is specified.

    http://windows.microsoft.com/en-PH/windows-vista/Change-the-default-e-mail-program

    2. Make sure both the RB application and the Outlook application are running
    with the same security rights.

    http://www.digital-metaphors.com/rbWiki/Output/Email/Troubleshooting..._Cannot_Preview_Email

    3. RB 14 includes a plug-in for ExtendedMapi if you want to give that a try.
    Note that Extended MAPI is only supported by Outlook, other email clients
    support SimpleMapi (the default plug-in). That is a MS limitation/email
    client limitation - not ours.

    You can register an SMTP plug-in using Massimo's example or using the
    example in this rbWiki article. You will need to include ppSMTPExtendedMapi
    in the uses clause and call

    TppSMTPPlugIn.RegisterClass(TppSMTPExtendedMapi);

    http://www.digital-metaphors.com/rbWiki/Output/Email/Email_Fundementals


    3. I read the article mentioned by Massimo. At the bottom it claims that
    SendMail should work, which is what we use for the Simple MAPI plug-in. For
    ExtendedMAPI the article says you need to know whether you are using Outlook
    32-bit (most common, even for 64-bit Windows) or Outlook 64-bit. Once you
    know that then you need to build either a 32-bit Delphi application or a
    64-bit Delphi application. Also note, despite the name, SimpleMAPI and
    ExtendedMAPI are very different technologies. Massimo says he has good luck
    using EasyMapi - which is a friendly wrapper for ExtendedMapi, so perhaps
    our ExtendedMAPI plug-in is worth a try. MS has increased security for the
    latest Windows versions and they have tighter security on SimpleMAPI than
    ExtendedMAPI.

    http://msdn.microsoft.com/en-us/library/dd941355(office.14).aspx



    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.