Hello,
I'd like to report a possible behavior change between FWH 26.03 (32-bit) and previous versions regarding the DEFINE MAIL command / MAPISendMail().
Environment:
FWH 26.03, 32-bit build
Default mail client: Mozilla Thunderbird (set as system MAPI client)
Code used (unchanged for several versions, worked correctly until the previous FWH version):
DEFINE MAIL oMail ;
SUBJECT cOggetto ;
TEXT cTesto ;
FILES cFile , cFileNoPath( cFile ) ;
TO cEmail ;
FROM USER
ACTIVATE MAIL oMail
Observed behavior:
With FWH 26.03, Thunderbird opens correctly with subject, body and attachment, but the recipient ("To:") field is empty, even though a valid, non-empty cEmail is passed.
Analysis:
I checked mail.ch and the command translation rule:
#xcommand DEFINE MAIL [<oMail>] ... [ TO <cTarget1> [,<cTargetAddress1>] ... ] => ...
\{ [ \{<cTarget1>,<cTargetAddress1>\} ] ... \}, ...
When only one parameter is passed after TO (just cEmail, without a second "address" parameter), the preprocessor generates a single-element sub-array: { { cEmail } }, where cEmail ends up in the "name/target" slot, while the "address" slot (cTargetAddress1) is completely absent, not just empty.
Hypothesis: in previous versions, the C code of MAPISendMail() likely had a fallback (if lpszAddress was empty, use lpszName as the address too), which masked this incomplete syntax. Outlook still resolves the name as an address on its own; Thunderbird's stricter Simple MAPI implementation leaves the "To:" field empty if lpszAddress isn't explicitly set.
Verified workaround:
Explicitly pass the address twice:
TO cEmail, cEmail
so that both the "name" and the "address" fields in the MapiRecipDesc struct are populated with the correct email address.
Questions for support:
Is this an intentional change in how MAPISendMail() builds the MAPI struct (e.g. removal of a name→address fallback), or an unintended regression?
If intentional, it would be worth documenting explicitly, since the TO <cTarget1> [,<cTargetAddress1>] pattern with a single parameter is very common in existing user code (including mine, originally copied from examples posted on this very forum).
Thanks in advance for any feedback.
Best regards