Table of Contents

Getting started with TMS FNC Cloud Google Gmail

Prerequisites

  • TMS FNC Core installed and the runtime package added to the project.
  • TMS FNC Cloud Pack installed.
  • An app registered in the Google Cloud Console with the Gmail API enabled, a client ID and secret, and a registered redirect URI.

Add the component

  1. Drop TTMSFNCCloudGoogleGmail onto a form (or create it in code).
  2. Set the app credentials on Authentication (client ID, secret, redirect URI).
  3. Call Connect to authenticate, then call Gmail operations from OnConnected.

Minimal example

Set the credentials, connect, and list the account's labels once connected:

procedure TForm1.FormCreate(Sender: TObject);
begin
  // Credentials from your app registration (https://console.cloud.google.com).
  TMSFNCCloudGoogleGmail1.Authentication.ClientID := 'your-client-id';
  TMSFNCCloudGoogleGmail1.Authentication.Secret := 'your-client-secret';
  // Must match a redirect URI registered on the app.
  TMSFNCCloudGoogleGmail1.Authentication.CallBackURL := 'http://127.0.0.1:8000';

  TMSFNCCloudGoogleGmail1.OnConnected := GmailConnected;
  // Opens the Google consent page in the browser and exchanges the code for tokens.
  TMSFNCCloudGoogleGmail1.Connect;
end;

procedure TForm1.GmailConnected(Sender: TObject);
begin
  TMSFNCCloudGoogleGmail1.GetLabels;
end;

Next steps