Topic: [SOLVED]Tablegrid contents to Email
I have a need to take selected items from a table grid and place them in the body of an email.
The code below using a stringlist works to an extent, however whilst my test 'showMessage' does show what I want, by the time it gets to an email body only the first two items ever show.
I could copy to clipboard and then manually paste into the email body, but that is unsatisfactory as I hope to make this automatic with the user only having to press 'send' in their email client.
My current code is
procedure frmEmail_SendEmail_OnClick (Sender: TObject; var Cancel: boolean);
const
CRFL = #13#10;
var
emailList : TStringlist;
indx,colmn : integer;
begin
emailList:= TStringList.Create;
emailList.Clear;
for indx := 0 to frmEmail.tbgEmailList.RowCount -1 do
begin
for colmn := 0 to frmEmail.tbgEmailList.Columns.Count -1 do
begin
emailList.add(frmEmail.tbgEmailList.Cells[colmn,indx]);
end;
emailList.add(CRFL);
end;
// try
//st := clipboardGet;
openURL('mailto:'+frmEmail.cmbEmailAddress.Text+'?Subject='+frmEmail.cmbSupplierList.Text+' Order'+'&Body='+ emailList.text);
emailList.free;
// SQLExecute('UPDATE orders SET orderEmailed = 1 WHERE orders.id =');
end;