I created a test project with TTMSFNCCloudGoogleGmail.
TMSFNCCloudGoogleGmail.Authentication.ClientID := MyId;
TMSFNCCloudGoogleGmail.Authentication.Secret := MySecret;
TMSFNCCloudGoogleGmail.Authentication.CallBackURL := 'http://127.0.0.1:8888';
MyGmailMessage := TMSFNCCloudGoogleGmail.Mails.Add;
With MyGmailMessage Do
Begin
Subject := 'Test';
MessageType := mtHTML
HTMLBody := 'line 1'+#13+'line 2'; //Body / HTMLBody
ToRecipients.Add('starhu@gmail.com') ;
End;
TMSFNCCloudGoogleGmail.SendMessage(MyGmailMessage);
Everything ran without an error, however the email didn't arrive (it wasn't in the spam folder either). I also wasn't in the Sent folder. I tried it with several gmail addresses and several Recipients.
Then I thought that I will try your own demo: TMSFNCCloudGoogleGMail.pas (which is in tmssoftware\registered\TMS FNC Cloud Pack\Demos\Overview Demo\VCL\Demo.dpr)
This program also "sent" the email (even wrote that "done" or something like that), yet the emails didn't arrive.
The log from your application:
We are not aware of any issues with sending emails through TTMSFNCCloudGoogleGMail.
Please note that the Connect call is asynchronous. So it is recommended to use the OnConnected event to make sure the connection process has finished successfully before sending mails.
I've modified your sample code accordingly. This is now working as expected when tested here.
procedure TForm2.Button1Click(Sender: TObject);
begin
TMSFNCCloudGoogleGmail.Authentication.ClientID := ClientID;
TMSFNCCloudGoogleGmail.Authentication.Secret := Secret;
TMSFNCCloudGoogleGmail.Authentication.CallBackURL := 'http://127.0.0.1:8888';
TMSFNCCloudGoogleGmail.PersistTokens.Location := plIniFile;
TMSFNCCloudGoogleGmail.PersistTokens.Key := '.\Gmail.ini';
TMSFNCCloudGoogleGmail.PersistTokens.Section := 'tokens';
TMSFNCCloudGoogleGmail.LoadTokens;
TMSFNCCloudGoogleGmail.Connect(nil);
TMSFNCCloudGoogleGmail.SaveTokens;
end;
procedure TForm2.TMSFNCCloudGoogleGmailConnected(Sender: TObject);
var
MyGMailMessage: TTMSFNCCloudGoogleGMailMessage;
begin
MyGmailMessage := TMSFNCCloudGoogleGmail.Mails.Add;
With MyGmailMessage Do
Begin
Subject := 'Test';
MessageType := mtHTML;
Body := 'line 1<br>line 2'; //Body / HTMLBody
ToRecipients.Add(EmailAddress) ;
End;
TMSFNCCloudGoogleGmail.SendMessage(MyGmailMessage);
end;