How to send and receive reports via Outlook in FastReport VCL

How to send and receive reports via Outlook 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 GMail at the following link.

Content

- Adding Transport to the Application and its setting
- Connecting to Outlook
- 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, Box.com, 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

ListenerPort. 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 Outlook

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 the default browser with the Azure Application Management page. If the user is not authorized in Azure, then an authorization page will open, where you will need to sign in to your Azure account.

If this account has never created an Azure app before, the first step will be to create a new app.

Application management page

First, you need to create a new application. Click the "Register an application" button.

New App Registration Page

At this point, you must enter an application name, select supported account types, and fill in the Redirect URI.

For effortless setup, in the “Types of supported accounts” property, select the third item “Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)”. You can read more about this by clicking on “Help me choose...”.

If you want to use the standard port, enter "http://localhost:9898" in the Redirect URI field.

Click the "Register" button. Our application will be successfully created.

New App Registration Page

Copy the value of the “Client ID” field into the FastReport VCL authorization dialog. Open the “Certificates & secrets” section.

Private Key Management Page

Click on "New client secret".

Popup window for creating a new private key

Enter a description and select an expiration date for the code. Click "Add".

Page for registering the new app with a new private key

Copy the “Value” to the FastReport VCL authorization dialog.

Completed standard dialog for authorizing mail transport

Click "Ok". A new browser window will open asking you to sign in to your account.

Permission Request Page

Сlick "Yes" аfter authorization.

Standard dialog for downloading attached files

This completes the successful connection setup. Now you know how to connect to Outlook 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)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.
Trustpilot