Microsoft Dynamics Ax developer's blog

Thursday, June 21, 2007

Sending attachments using the "mailto:" protocol

It works with Outlook at least. I think this example job is enough

static void Test_MailTo(Args _args)
{
str recepient='mbelugin@gmail.com';
str subject = 'Test';
str attachment = @'c:\AUTOEXEC.BAT';
str url = strFmt(
'mailto:%1?Subject=%2&attachments=""%3""',

recepient,
subject,
attachment
);
;
WinApi::shellExecute(url);
}