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
- Drop
TTMSFNCCloudGoogleGmailonto a form (or create it in code). - Set the app credentials on
Authentication(client ID, secret, redirect URI). - Call
Connectto authenticate, then call Gmail operations fromOnConnected.
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
- Authentication — credentials, the OAuth flow, and persisting tokens
- Labels and messages — listing labels and retrieving messages
- Attachments and inline images — downloading attachments and embedding inline images
- Sending, labeling and deleting — composing, sending, labeling and deleting messages
- API reference — full class reference