How to send and receive reports via Gmail in FastReport VCL

How to send and receive reports via Gmail in FastReport VCL

In this article, you will be introduced to a new sub-category of transports that became available with version 2022.2.7 and which is called “mail transports”. Now it includes 2 components with access to Gmail and Outlook.

Mail transports have the following functionality:
- saving and loading a report;
- saving the export result.

Saving means sending an email. Uploading involves the use of files attached to the letter, while the letter can be in any mail category (inbox/sent/drafts etc.).

You can read more about using Outlook at the following link.


- Adding Transport to the Application and its setting
- Connecting to Gmail
- The future of mаil transports

Current state of transports

FastReport has components called “transports”. They are required to аllow access to:

- cloud storage (Dropbox, OneDrive,, Google.Drive, Yandex.Disk);

- FTP-servers;

- Email (only sending messages);

- mail service (Gmail, Outlook).

Cloud storage and FTP servers support the following functionality:
- saving and loading a report;
- saving the export result;
- using files (for example, pictures) when building a report.

Adding Transport to the Application and its setting

Adding the Transport

1. Go to the component palette in the Embarcadero Rad Studio and expand the “FastReport VCL Internet transports” tab.

2. Select the required component and add it to the application form. You can use the context menu on the component — this will establish the connection directly from the development environment. Click on the “Edit connection” submenu.

Popup window when right-clicking on a component

By default, transports respond only to an authorization response from a browser using port 9898. If this port is already used or you plan to use this port in the future, FastReport VCL allows you to change the port by setting the ListenerPort property.

Object Inspector after Selecting a Transport

Further, we will take port 9898 by default. Now let's look at the connection steps for mail transports.

Important! The user does not need to perform all of the following steps every time to authorize. This setting is done only once by the cloud services administrator. After completing all the steps, the obtained authorization data can be used by other users.

Connecting to Gmail

When a user wants to open (or save) a report (or export a result) using the transport, he will see the standard login dialog (if he has not logged in before).

Standard Mail Transport Authorization Dialog

To go to the connection settings page, click on the question mark at the top right of the authorization window. This will open your default browser with the Gmail app settings page. If the user is not authorized in Gmail, an authorization page will open, where you will need to log into your Gmail account.

If this account has not previously added projects to work with the Google API, then you first need to create a new project.

Application settings page

Click on the "Create project" button.

Page for creating a new project

Enter a project name and click "Create".

Button for selecting the current project on the application settings page

Use the “Select project” button to select the created project.

Page for selecting current project

Select the project you created earlier and click “Open”.

OAuth authorization settings page

Go to the “OAuth consent screen” tab. We need to select the users that can use cloud storage: internal use (only users of the organization) or for all Google accounts. Then click the “Create” button.

The first stage of OAuth authorization settings

Next, you need to fill in the application name and contact e-mail. Click "Save and continue".

This step allows you to set the scope, you can skip it for Google Mail. Click on "Save and continue".

The next step allows you to setup access to the application for a specific group of users. You can skip this step if you are going to аllow access to the application. Click "Save and continue".

The application has been created, go to the “Back to dashboard” tab.

Successfully configured OAuth authorization

Go to the “OAuth consent screen” tab and click on “PUBLISH APP” to open access to this application. Open the following link and enable the Google Mail API for the created project by clicking the “Enable” button.

Setting permission to the Gmail API

Now you need to create authorization keys, go to the "Credentials" tab.

Authorization Key Management Page

Click on "Create Credentials" and select "OAuth client ID".

Possible types of creating authorization keys

You should select the type of application (in our case, Desktop App).

Selecting the type of application on the page for creating authorization keys

Enter any name for the connection and click "Create". The authorization client will be created.

Fragment of the page with the generated ID-Secret pair

Copy the fields “Client ID” and “Client Secret” into the corresponding entry fields of the FastReport VCL authorization dialog.

Completed standard dialog of mail transport authorization

Click OK. A new window should open in your default browser. The screen will prompt you to select an account for authorization.

Standard account selection for authorization

Next, we will see that Google hasn’t verified the application. Click “Advanced” and Go to the Application name (unsafe).

Page with the warning

Another dialog asking аbout access to the application will аppeаr, select access rights and click “Continue”.

Permission Request Page

You can close the browser window. If the connection is successful, you will see the standard FastReport VCL file browser.

Standard dialog for downloading attached files

This completes a successful connection setup. Now you know how to connect to Gmail in FastReport VCL.

The future of mаil transports

Functionally, cloud transports support all the previously mentioned features. The graphic design of mail transports during loading will be improved in further releases. So far, the graphical user interface (GUI) is used as cloud storage. Now categories and messages are implemented as folders and attachments as files.

Standard dialog for downloading attached files

In the future, it is planned to improve the graphic component, making it more user-friendly. Functional improvements will include a search by mаil.

The GUI of the send message window will also be slightly changed.

Standard dialog for uploading files

We will also note the temporary feature of sending the export result. If the export generates multiple files, then each file is sent in its own email. That is, if you want to send the export result to a page-by-page PNG, then each picture will be sent in a separate email.

Almost all exports to FastReport VCL generate only 1 output file (PDF, DOCX, RTF and others), most users won’t notice this.

We will fix the bug in future releases. For all questions, contact our Support.

Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.