If I understand correctly, TSendMail is supposed to use my installed email client. If I execute it on my virtual machine, it returns "true" and gives me the expected message that I need to install an email program.
However, if I run the program on my regular machine (on which Thunderbird is installed) TSendMail.execute returns "True", but Thunderbird doesn't get called. Here's my code:
procedure TfSendEmail.btnSendClick(Sender: TObject);
var
aNode: PVirtualNode;
Data: PRecipients;
i: integer;
begin
aNode := vstRecipients.GetFirst;
i := 0;
while (aNode <> nil) do
begin
Data := vstRecipients.GetNodeData(aNode);
Mail.Recipients.Add;
Mail.Recipients[i].DisplayName := Data.Name;
Mail.Recipients[i].Address := Data.Email;
inc(i);
aNode := vstRecipients.GetNext(aNode);
end;
Mail.Attachments.Assign(lbAttachments.Items);
Mail.Subject := edtSubject.Text;
Mail.Text.Assign(mmoMsgText.Lines);
if Mail.Execute then
begin
ShowMessage('Succeeded');
//ModalResult := mrOk;
end
else
MessageDlg('Sorry!. Could not send email.', mtError, [mbOK], 0);
end;
Using Delphi 10.2.3 on fully updated Win10 machines. Maybe my recipient assignment is faulty. Anyway, I can't find any complete usage examples, only the incomplete example on attachments from Embarcadero's wiki.