Einzelnen Beitrag anzeigen

question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

Send email via msoutlook

  Alt 15. Sep 2013, 13:59
Hi,
i am usung the following example code to send email via msoutlook,but i got the error "vorgang abgebrochen"
Code:
procedure TPersoncon.SendmailClick(Sender: TObject);
const
  olMailItem = 0;
var
  Outlook: OLEVariant;
  Mail: Variant;
  MailInspector : Variant;
  stringlist : TStringList;
begin
  try
   Outlook:=GetActiveOleObject('Outlook.Application') ;
  except
   Outlook:=CreateOleObject('Outlook.Application') ;
  end;
  try
    Stringlist := TStringList.Create;
    Mail := Outlook.CreateItem(olMailItem) ;
    Mail.Subject := 'subject';
    Mail.Recipients.Add('email@email.de');//Here i got the error "vorgang abgebrochen"
    Mail.Attachments.Add('attachemnt');
    Stringlist := TStringList.Create;
    StringList.Add('Details');
    MailI.Body := StringList.text;
    MailInspector := MailItem.GetInspector;
    MailInspector.display(true);
  finally
    Outlook := Unassigned;
    StringList.Free;
  end;
end;
  Mit Zitat antworten Zitat