Hello Team,
I am Using "Email Item" Table directly to send custom mail. I now need help to add attachment. I need to add a custom report in attachment.
Below is the code.
action(Send)
{
ApplicationArea = all;
Promoted = true;
trigger OnAction()
var
EndLine: Char;
EndLine2: Char;
begin
EndLine := 13;
EndLine2 := 10;
WITH TempEmailItem DO BEGIN
"Send to" := 'xyz@gmailcom';
Subject := 'Purchase Order# ' ;
"Message Type" := "Message Type"::"Custom Message";
CLEAR(Body);
Body.CREATEOUTSTREAM(BodyStream);
BodyStream.WriteText('Dear Sir/Madam,' + FORMAT(EndLine) + FORMAT(EndLine2));
BodyStream.WriteText('');
BodyStream.WriteText('Please find attached Purchase Order# ');
// "Attachment File Path" := FileManagement.Magicpath();
//"Attachment Name" := 'PO Report.pdf';
Commit();
CalcFields(Body);
Commit();
Send(FALSE);
end;
end;
}