0

In a Delphi 10.4.2 VCL Application in Windows 10, I followed the TSendMail example here:

http://docwiki.embarcadero.com/CodeExamples/Sydney/en/TSendMail_(Delphi)

... to create a InternetSendMail1 action in the ActionList.

But when I execute this code:

var OK := InternetSendMail1.Execute;
CodeSite.Send('OK', OK);

OK returns True.

But nothing happens: No email is opened.

My email client Thunderbird is a regular registered MAPI mail client working perfectly for many years: For example, when I click a mailto link then a new email is created in Thunderbird etc.

So what must I do to make the InternetSendMail1 action work?

EDIT: I finally realized that what I want to do is not actually sending a mail but creating a mail with an attachment, so the user can edit it with a recipient, body, etc., and then send it after he has finished editing it. So I changed the question from "How to send a mail with TSendMail?" to "How to create a mail with TSendMail?".

user1580348
  • 5,721
  • 4
  • 43
  • 105
  • It works for me (Windows 7, 64-bit, Microsoft Outlook 2010, Delphi 10.3). – Andreas Rejbrand Jul 15 '21 at 23:14
  • Are you running Thunderbird with elevated privileges and your Delphi test app without? – Andreas Rejbrand Jul 15 '21 at 23:18
  • Amazingly, I am unable to find the MSDN reference for `MapiSendMail`... (I almost get the feeling that `MapiSendMail` isn't supported on Windows 8 and later. See https://learn.microsoft.com/en-us/previous-versions/windows/desktop/windowsmapi/simple-mapi) – Andreas Rejbrand Jul 15 '21 at 23:23
  • Thunderbird is not running with elevated privileges. However, I found a solution that works and does exactly what I want: `JclMapi.JclSimpleBringUpSendMailDialog('Subject', '', 'C:\Docs\Todo.txt');` – user1580348 Jul 16 '21 at 06:39
  • "The use of Simple MAPI is discouraged. It may be altered or unavailable in subsequent versions of Windows." - But it works in Windows 10 (JclMapi). Why would Microsoft discourage the use of a well-working protocol? Marketing strategy to promote their own products instead? – user1580348 Jul 16 '21 at 09:04
  • @user1580348: MS bashing went out of style two decades ago, and isn't appropriate here even in comments. MS is most likely removing it because of misuse of it by malware authors, but to find out for sure, ask them via their support site. – Ken White Jul 18 '21 at 23:33
  • Your accusation of "MS bashing" is wrong. My posting was an objective statement. "misuse of it by malware authors" is an invalid argument, as in reality anything (even and especially MS software) can be misused as malware. And that is not meant as bashing. – user1580348 Jul 20 '21 at 08:57

0 Answers0