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.
Important! For the HTTPS protocol to function properly, the following OpenSSL libraries are required: libssl-3.dll and libcrypto-3.dll. These libraries can be found in the directory with the main demo application. They need to be copied to the application's folder or the system directory.
- Adding Transport to the Application and its setting
- Connecting to Outlook
- The future of mаil 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.
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.
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.
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.
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).
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.
First, you need to create a new application. Click the "Register an application" button.
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.
Copy the value of the “Client ID” field into the FastReport VCL authorization dialog. Open the “Certificates & secrets” section.
Click on "New client secret".
Enter a description and select an expiration date for the code. Click "Add".
Copy the “Value” to the FastReport VCL authorization dialog.
Click "Ok". A new browser window will open asking you to sign in to your account.
Сlick "Yes" аfter authorization.
This completes the successful connection setup. Now you know how to connect to Outlook in FastReport VCL.
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.
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.
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.