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

Email capabilities in RB 10

edited February 2006 in General
Do you have any documentation on the email capabilities in RB 10? We
have not upgraded from version 9 yet, but I was given a project today
that might warrant the upgrade. We would like to send our invoices and
statements by email. Each page my need to be sent to a different
recipient - it would depend on the grouping. Just wondering.

Thanks,
Nick

Comments

  • edited February 2006
    Hi Nick,

    Although this is not a built-in feature of the ReportBuilder email, it is
    definitely possible to email separate invoices to each individual recipient
    by generating a new report for each customer. This would consist of
    creating a loop that would generate and send a separate report for each
    customer based on a dynamic search criteria in the query connected to the
    report.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2006
    Some more background...

    Sending a Report via email is very simple using the new Email feature if
    ReportBuilder 10.

    Emailing a report programmatically...

    The TppReport.SendMail routine has been added to make the process of
    automatically exporting and emailing a report very easy. In order to
    successfully email a report you will need to follow the steps below.

    1. Select an Email plugin: By default the MAPI plugin is used. This
    plugin attempts to use the default email client on your machine to send the
    report. Other plugins available are, Outlook (ppSMTPOutlook.pas) and Indy
    (ppSMTPIndy.pas). Simply adding one of these files to your uses clause will
    register this plugin with RB.

    2. Define the TppReport.EmailSettings: This is a set of published
    properties that will need to be defined in order to successfully send an
    email.

    3. Call TppReport.SendMail: Once the EmailSettings have been defined,
    calling SendMail will automatically export the report and send it to the
    recipient(s).

    (Psuedo Code)

    Example 1: Send One Report.

    uses
    ppSMTPIndy;

    ---

    begin
    //For Indy the server address, username, and password need to be defined.
    Report.EmailSettings.HostAddress := 'mail.mail.com';
    Report.EmailSettings.UserName := 'RBUser';
    Report.EmailSettings.Password := '12345';

    Report.EmailSettings.Recipients.Add('you@you.com');
    Report.EmailSettings.Body.Add('See Attached Report');
    Report.EmailSettings.ReplyTo := 'me@me.com';

    Report.SendMail;
    end;

    Example 2: Send Multiple Reports.

    uses
    ppSMTPIndy;

    ---

    begin
    //For Indy the server address, username, and password need to be defined.
    Report.EmailSettings.HostAddress := 'mail.mail.com';
    Report.EmailSettings.UserName := 'RBUser';
    Report.EmailSettings.Password := '12345';

    Report.EmailSettings.Body.Add('See Attached Report');
    Report.EmailSettings.ReplyTo := 'me@me.com';

    for each customer...
    begin
    Update connected dataset to select only one customer...

    Report.EmailSettings.Recipients.Add(CustomerEmail);

    Report.SendMail;
    end;

    end;

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2006
    Thanks for the info.

    Nick

This discussion has been closed.