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

Emailing reports when Office 2007 is installed

edited November 2008 in General
Greetings,
I have an app that allows emailing of various reports. It works fine when
office 2003 (and earlier) is installed, but doesn't seem to work with Office
2007.

Any ideas?

My environment:
D6
RB 10.9
Win XP

Thanks in Advance,
Kevin

Comments

  • edited November 2008
    Hi Kevin,

    This is not a known issue. Which email plugin are you using to access
    Outlook? Are you able to get the same behavior when running the email demo
    located in the \RBuilder\Demos\1. Reports\... directory (dm0110.pas). We
    have used and tested Office 2007 (Outlook 2007) since its release on our
    machines and have not seen any behavior like this. Below are a couple
    things to try...

    1. Try shutting Outlook down before sending an email.
    2. Try sending an email from a different machine.
    3. Implement the OnEmailError event and see if the MAPI client is giving an
    error message.

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

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2008
    Thanks and good to hear it has not been an issue.
    I will take a look and get back to you.
    Thanks,
    Kevin

  • edited November 2008
    This is a multi-part message in MIME format.
  • edited November 2008
    This is a multi-part message in MIME format.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2008
    If I don't specify anything in the EmailSettings, where does RB write out
    the temp .pdf file that gets attached to the email?
    Thx,
    Kevin

  • edited November 2008
    Hi Kevin,

    If no file is defined in the Report.EmailSettings.FileName, the Windows API
    function GetTempPath is called to assign a path. The name of the file is
    set to the Report.PrinterSetup.DocumentName property. Below is how the
    GetTempPath function works according to the API docs...

    ---

    The GetTempPath function checks for the existence of environment variables
    in the following order and uses the first path found:

    1. The path specified by the TMP environment variable.
    2. The path specified by the TEMP environment variable.
    3. The path specified by the USERPROFILE environment variable.
    4. The Windows directory.


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2008
    Thanks Nico - I'll take a look at this as this is a very important part of
    my app that I need to get resolved.
    I'll keep digging.
    Kevin


  • edited November 2008
    Nico -

    Here is what I've done.
    - I've created an even simpler app with 2 buttons, one to preview the
    report, and one to send an email using Raize Components (TRzSendMessage
    component).
    - The report uses a simple text file as data for the report.
    - Works perfectly on my PC: Win XP, D6, RB10.09, Office 2003.
    - I sent this app to a business partner of mine that uses Office 2007.
    Worked perfectly - brought up the email (preview) before sending.
    - This same simple app is still not working on the Terminal Server.
    - I have wired up the event for showing email errors - none are displayed.
    - I have even hard-coded directory/file name for the PDF being created with
    still no affect.

    Any ideas where I might start looking? It's kind of pointing to the
    Terminal Server but I and my biz partner (he's the network support guru -
    very good) have idea where to begin looking.
    Other than the OnEmailError event, is there any other kind of logging we can
    take a look at?
    Could it be that I'm using an older Indy?

    Thanks for all your help (this is still quite critical for my app)!

    Kevin

    Here is the entire unit (very small):

    unit MainFrm;

    {$I ppIfDef.pas}

    {----------------------------------------------------}
    {To enable the Indy section of this example you must
    first define which version of Indy you currently
    have installed.}

    {Remove "x" if you are using Indy 10.}
    {x$DEFINE Indy10}

    {Remove "x" if you are using Indy 9.}
    {x$DEFINE Indy9}

    {Remove "x" if you are using Indy 8 or earlier.}
    {$DEFINE Indy8}

    {----------------------------------------------------}


    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, ppProd, ppClass, ppReport, ppComm, ppRelatv, ppDB, ppTxPipe,
    ppEMail, ppSMTPCustom, ppSMTPMAPI //Include MAPI support.

    {$IFDEF Indy10} //Include Indy support.
    ,ppSMTPIndy10
    {$DEFINE IndyEnabled}
    {$ENDIF}

    {$IFDEF Indy9}
    ,ppSMTPIndy9
    {$DEFINE IndyEnabled}
    {$ENDIF}

    {$IFDEF Indy8}
    ,ppSMTPIndy, ppCtrls, ppPrnabl, ppBands, ppCache, StdCtrls, rdEnvVars,
    RzSndMsg
    {$DEFINE IndyEnabled}
    {$ENDIF};

    type
    TfrmMain = class(TForm)
    ppTextPipeline1: TppTextPipeline;
    ppReport1: TppReport;
    btnPreview: TButton;
    ppHeaderBand1: TppHeaderBand;
    ppDetailBand1: TppDetailBand;
    ppFooterBand1: TppFooterBand;
    ppTextPipeline1ppField1: TppField;
    ppTextPipeline1ppField2: TppField;
    ppTextPipeline1ppField3: TppField;
    ppTextPipeline1ppField4: TppField;
    ppLabel1: TppLabel;
    ppDBText1: TppDBText;
    ppLabel2: TppLabel;
    ppDBText2: TppDBText;
    ppLabel3: TppLabel;
    ppDBText3: TppDBText;
    ppLabel4: TppLabel;
    ppDBText4: TppDBText;
    rdEnvVars1: TrdEnvVars;
    btnEmail: TButton;
    rzEmail: TRzSendMessage;
    procedure btnPreviewClick(Sender: TObject);
    procedure btnEmailClick(Sender: TObject);
    private
    { Private declarations }
    procedure EMailErrorEvent(Sender: TObject; aErrorText: String);
    public
    { Public declarations }
    end;

    var
    frmMain: TfrmMain;

    implementation

    {$R *.dfm}

    procedure TfrmMain.btnPreviewClick(Sender: TObject);
    var
    s: string;
    begin
    TppEmail(ppReport1.Email).SMTP.OnEmailError := EmailErrorEvent;

    s := 'd:\ftp';
    ppReport1.EMailSettings.FileName := s + '\ATestReport.pdf';
    ppReport1.TextFileName := s + '\ATestReport.pdf';
    ShowMessage(ppReport1.EMailSettings.FileName);

    //Register MAPI plugin...
    TppSMTPPlugIn.RegisterClass(TppSMTPMapi);

    ppReport1.EmailSettings.ShowEmailDialog := False;
    ppReport1.EmailSettings.PreviewInEmailClient := True;

    ppReport1.EmailSettings.Enabled := True;
    ppReport1.Print;
    end;

    procedure TfrmMain.EMailErrorEvent(Sender: TObject; aErrorText: String);
    begin
    ShowMessage(aErrorText);
    end;

    procedure TfrmMain.btnEmailClick(Sender: TObject);
    begin
    // rzEmail.Attachments.Add(ppReport1.EMailSettings.FileName);
    rzEmail.Attachments.Add('d:\ftp\atestreport.pdf');
    rzEmail.Send;
    ShowMessage('Email complete');
    end;

    end.






  • edited November 2008
    Hi Kevin,

    This is a difficult one. Below are a couple suggestions.

    1. Are you trying to send these emails using Outlook 2007 or Indy? If you
    are using Outlook, then you will be using the MAPI plugin, not the Indy
    plugin.

    2. Try creating a simple example that exports the report to PDF and see if
    you are able to at least get this far.

    3. Check to be sure your virus software or firewall is not blocking the
    application or any specific email ports. Try running the email example in
    the Demos directory using the Indy plugin to see if the available ports are
    opened.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2008
    Hey Nico,

    Just thought I would follow up on this.
    I never did get RB's built-in email to work. I used the Indy demo that
    comes with Delphi 6 and it worked fine so I'm in the process of implementing
    the structure of creating a PDF with RB and sending with Indy. Only bummer
    is the email not being logged as sent in MS Outlook.

    Take care and thanks for the help.

    Kevin



  • edited December 2008


    RB's built-in email includes plug-ins for MAPI, Indy, and Synapse.


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

    Best regards,

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