Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
Outlook : OleVariant;
vMailItem: variant;
begin
try
Outlook := GetActiveOleObject('Outlook.Application');
except
Outlook := CreateOleObject('Outlook.Application');
end;
vMailItem := Outlook.CreateItem(olMailItem);
vMailItem.Recipients.Add('fulando@mundo.com.br'); // 1st recipient
vMailItem.Recipients.Add('ciclano@mundo.com.br'); // 2dn recipient
vMailItem.Subject := 'teste de email'; // subject
vMailItem.Body := 'Este é um teste'; // mail body
vMailItem.Attachments.Add('C:\temp\arq.txt'); // Attached file
vMailItem.Send;
VarClear(Outlook);
end;