I've setup an email account in BC (type: Smtp).
I have a procedure (see code below) which is working fine except that the From Address is coming from the Email Account and not from the code below.
procedure SendEnhancedEmail()
var
recTempEmailItem: Record "Email Item" temporary;
begin
Clear(recTempEmailItem);
recTempEmailItem.Reset();
recTempEmailItem.Init();
recTempEmailItem.Initialize();
recTempEmailItem."From Address" := 'nick.webb@o-net.co.uk'; // <- This line is being ignored.
recTempEmailItem."Send to" := 'nick.webb@o-net.co.uk';
recTempEmailItem.Subject := 'This is a test subject';
recTempEmailItem.SetBodyText('This is a test body.<br>This is Line 2.');
recTempEmailItem.Insert();
recTempEmailItem.Send(true, "Email Scenario"::Default);
end;
How do I set the From Address at runtime in an AL extension?