如何用ShellExecute发送邮件时附加文件?
如下程序,如何附加文件?
procedure TForm1.BtnSendClick(Sender: TObject);
var
strMsg: string;
I: Integer;
begin
// set the basic information
strMsg := 'mailto:' + EditAddress.Text +
'?Subject=' + EditSubject.Text +
'&Body=';
// add first line
if Memo1.Lines.Count > 1 then
strMsg := strMsg + Memo1.Lines [0];
// add subsequent lines separated by the newline symbol
for I := 1 to Memo1.Lines.Count - 1 do
strMsg := strMsg + '%0D%0A' + Memo1.Lines [I];
// send the message
ShellExecute (Handle, 'open', pChar (strMsg),
'', '', SW_SHOW);
end;
另外,该程序为何memo1多一点内容运行就会出错?