Gmail REST Api Sample

edited May 2017 in General
Hi folks,

I would like to put to use the new gmail support for email, but couldn't
find any sample/documentation.

Could you please provide some sample code?



  • edited May 2017
    Hi Mario,

    I checked and it appears the documentation included in the source files
    was not added to our built-in help files. I will fix this for the next
    release. I pasted the documentation below for reference or you can view
    it at the top of the ppRESTMailGmail.pas source file.

    There is no code needed to use these plugins, you simply add them to
    your uses clause and the email will send via REST API. There is however
    an amount of setup that is required for this to function (see below).



    Use this email plugin to connect and send mail using the Gmail REST

    This service requires OAuth2 authentication meaning that the reporting
    application will not need to know the user's credentials in order
    to connect
    and send email.

    To use this service, the application must first be registered in the
    Google API Manager where a Client ID, Client Secret, and Redirect
    URI can be created and assigned to the corresponding values in the
    TppEmailSettings.OAuth2 property.

    The steps below outline the registration process:

    Note: A Google account is required to continue. Visit
    to create a new account.

    1. Open the Google Developers Console by visiting the following web
    site and log
    into your account.

    2. Ensure the "Gmail API" is enabled by selecting it from the list
    of Google
    APIs. Note that it may already be enabled and listed in the
    "Enabled APIs"

    3. On the left side of the screen, select "Credentials". Then
    click the
    "Create Credentials" drop down and select "OAuth Client ID".

    4. Select "Web Application" and give your application a meaningful
    name that
    your users will recognize. Next define a Redirect URI in the
    redirect URIs" box and click "Create" Copy this value to the
    EmailSettings.OAuth2.RedirectURI property.

    5. Click "Create" again. A box will be displayed with the Client
    ID and
    Client Secret. Copy these values into their corresponding RB

    6. Select "OK" to finish registering your application. You are now
    ready to
    send email using the Gmail service.

    Best Regards,

    Nico Cizik
    Digital Metaphors
  • edited May 2017

    Thank you Nick, that would do.

    Mario Enriquez
  • edited May 2017
    Hi Nico,

    I followed the instructions in the source file and it worked for the
    most part, except it left the email in the draft folder instead on
    sending it right away.

    Do you know what could be causing this behavior?

  • edited May 2017
    Hi Mario,

    Try setting the Report.EmailSettings.PreviewInEmailClient property to
    False. When this is True, ReportBuilder assumes you would like to
    preview/edit the email before it is sent.

    Best Regards,

    Nico Cizik
    Digital Metaphors
  • edited May 2017
    On 5/10/17 8:16 AM, Nico Cizik (Digital Metaphors) wrote:

    Thank you Nico, that did the trick!

    And one last question...

    It is possible to automatically attach the report in the Send Email
    Dialog? I would like to avoid having the user select the
    Option->Report->FileName menu option to have the report included..

  • edited May 2017
    Hi Mario,

    The report will automatically be attached to the sent email, there is no
    need to use the file name option unless your users would like to
    customize the name of the exported report.

    Best Regards,

    Nico Cizik
    Digital Metaphors
This discussion has been closed.